Midterm 1

Pataasin ang iyong marka sa homework at exams ngayon gamit ang Quizwiz!

Comments

/* comment */ or // comment

Kernal

A central module of os, responsible for memory management, process and task management, and disk management. Has library and provides services to applications.

Data file

A collection of data on some media, Unix nearly everything is a file

System

A group of interacting, interrelated, or interdependent elements or parts that function together as a whole to accomplish a goal. Ex: System programming involves designing and writing computer programs that allow the computer hardware to interface with the programmer and the user, leading to the effective execution of application software on the computer system. Typical system programs include the operating system and firmware, programming tools such as compilers, assemblers, I/O routines, interpreters, scheduler, loaders and linkers as well as the runtime libraries of the computer programming languages.

Module

A module is reusable code that's is part of a program that contains a sequence of instructions for performaning a task thats forms a program Modules are used for dividing up the program into smaller, more easily understood, reusable parts.

Stuctures

A structure is an organized unit of data that is treated as a single entity (variable) • Can be defined like any other variable • Have an implicit "type" (whether typedef-ed or not) • Syntax struct { [definition] } [variable(s)];

Cognitive model

A way of representing something so we understand Ex: file system with files, folders, trash bin, etc.

passes arguments by value

C always does this value is "copied" into function • any local modification change is not reflecting in original value passed

Object file

Can contain external symbols for example, a .onthat relies on printf() is defined in libc.a Linking resolves external symbols by smooshing libraries and object files

Coerce

Convert type

Fit fields

Create numeric (integer) values that have a very specific width (in bits) Ex: uint32_t registered : 1;

OS Software

Directly interacts with the hardware Manages (allocates, schedules, protects) hardware resources Abstracts away messy hardware devices eg: files

Arrays

Don't know own length, no bound checking

Double freeing

Failing to free allocated memory

Failure independence

Faliure in only one process, not affecting the others.

Type casting syntax

For changing one variable type to another float x = (float) 5/3;

Firmware

Hardware's software, burned into hardware.

Object code

Has no address, is relocate lee machine code, cannot be executed without some manipulation (e.g., via a linker)

Privileged mode

Kernal trusted mode, mode where os runs in and has access to all system resources.

Kernal modules (good)

Kernel modules are pieces of code that can be loaded and unloaded into the kernel upon demand. They extend the functionality of the kernel without the need of recompilation.

virtual adresses

Large array of bytes, system provides adress space private to particular process

Shell script

List of commands to run

Assembly Language

Machine code that is directly executed by hardware

Compilation

Making programming language into executable code to be run by hardware, C compiler is gcc

Memory leaks

Memory being wasted when piece of memory is not properly deallocated by programmer.

%

Modulo division

process' address space

OS gives each process the illusion of its own, private memory

system requirements

Performance, security, fault tolerance, data consistency

Processes

Processes are independent programs running concurrently within the operating systems

Client is...

Running in user space.

*= ?

Same as a=a*b

Lion Cloud Devices

Sectors contains blocks both indexes are zero

Addresses

Specify byte locations, addresses of successive words differ by 4 (32-bit) or 8 (64-bit)

Three input types

Standard input (STDIN) • Standard output (STDOUT) • By default printf always goes to STDOUT • Standard error (STDERR)

Main()

Tells program where to start and returns 0 if program worked

typedef

The C typedef key words is a way of extending the C type system, i.e., to declare new new types for the compiler to recognize and use • Syntax: • where • old type is a type definition suitable for declaration • new type is the type to be added • Example: typedef [old type] [new type]; typedef unsigned char bitfield; the compiler treats the new type exactly as the old type (the new name acts simply as an alias for the original type)

Functional prototype

The body-less function declaration Ex: int sumTo(int);

Padding

The compiler is "padding" your structure with unused memory to make sure that number aligns with a multiple of the machine word size.

Word size

The number of bits that a CPU can manipulate at one time, which is dependent on the size of the registers in the CPU, and the number of data lines in the bus. the maximum number of bits that a CPU can process at a time. a word is the natural unit of data used by a particular processor design

Name resolution

The process of associating a character-based name with an IP address.

-v

To test the program

Unix

UNIX is multitasking and multiuser operating system -an abstraction provider

logMessage

Use the logMessage interface to log information about how your program is running.

Scheduling subsystem

Use to switch between program

malloc()

Used to allocate memory in heap segment free memory using free()

C99 ?

Used to specify how many bits

Unprivileged Mode

User mode is untrusted and has restricted access to system resources. user-level processes invoke a system call to safely enter the OS

Recompiling kernal solution 1 bad

User-space modules - creating user-space programs that support the operating system • leverages protection (against buggy code) • allows independent patching and upgrading • removes dependency on kernel version (mostly) • Problem: performance (interacting with user space is often much slower than in-kernal operations)

const double = x = 4.0; (const?)

Variable that cannot be modified

Scope

Visibility of variable, which part of your program can use it. Local scope is within a set of braces.

Accessing fields by pointer (dereferencing)

When handling a pointer to a struct, the fields are accessed with the "->" operator instead of the "."

Swap space

When physical memory is full(ram), inactive pages(divided chunks of memory ram) are moved to swap space, which is located on hard drive, which has slower access time than physical memory.

Tarball

a collection of files that have been tarred tar collects multiple files and directory data in a single file

Applications Programmer Interface

a set of functions and procedures (allowing the creation of applications) that access the features or data of an operating system, application, or other service. Ex: printf

Blocking

a signal means telling the operating system to hold it and deliver it later.

Device driver

a small piece of software in kernal space that tells the operating system and other software how to communicate with a piece of hardware. User space driver not good bc out of protection mode

Bus

a small software program that allows your computer to communicate with hardware or connected devices. This means that a driver has direct access to the internals of the operating system, hardware etc.

OS

a software layer that abstracts away the messy details of hardware into a useful, portable, powerful interface Provides powerful API

static

a variable that is global to the local file only • keyword static is used identify variable as local only Ex:static int localScopeVariable; // Static variable

Deference

access the memory referred to by a pointer • *pointer // dereference a pointer (Value at address) • *pointer = value; // dereference / assign

Controlled sharing

allows many users to share the computer resources simultaneously. Ex: there could be many users logged onto a mainframe, but user feels like it's only them.

low-level language

allows programmers to handle low level details like memory management low-level enough to be fast and to give the programmer control over resources Cons: error-prone, more complex

Data type

an abstraction that allows a programmer to treat different memory ranges as they were different types of data

Memory Heirarchy

an approach for organizing memory and storage systems ex: big space = slow performance, cheaper (cloud) and small space = fast performance, costlier

Buffering

any piece of memory where data is stored temporarily until it is processed or copied to the final destination

Shared Libraries .so

archives of binary code that are not physically linked into an executable file. The libraries are physically loaded into the computer's memory instead and during the linking stage of compilation, only the address in the memory of the library function is added in the final executable file. The physical code itself is located at that address.

Static library .a

archives of binary code that are physically linked into an executable file Static library contents physically exist in an executable that is linked to them

Enum

associate integer values with names, Compiler will assign integers to these values Ex: enum { SUNDAY, MONDAY, TUESDAY, WEDNESDAY, THURSDAY, FRIDAY, SATURDAY } daysOfWeek;

sudo

become super user root - can do anything

d0

contains a bit mask of present devices, where device there are a possible 16 devices,

Loading (loader)

creates an address space • inspects the executable file to see what's in it • (lazily) copies regions of the file into the right place in the address space • does any final linking, relocation, or other needed preparation

Interfaces

device or program enabling a user to communicate with a computer

int scores[100];

example allocates 100 ints worth of memory • initially, each array element contains garbage data sizeof(scores) tells how many bytes is type C Arrays are zero indexed!

high-level language

focus on productivity and usability over performance Slower and less control

global

globally defined variables that can be accessed anywhere within the program • keyword extern is used in .c/.h files to indicate a variable defined elsewhere Ex: extern int GlobalVariable; // Global variable defined elsewhere

stdio.h

header file just tells the compiler what' s available for use

Multi-dimensions arrays

int matrix[3][5] = { {0, 1, 2, 3, 4}, {0, 2, 4, 6, 8}, {1, 3, 5, 7, 9} }; grid[0][2] = (double) matrix[2][4]; 9

A way to Initialize all values In array

int val4[3] = { [0 ... 2] = 1 }; printf( "val4 [%d, %d, %d]\n", val4[0]

Types

int, float, double, char(used to create string, not string), long

File handler

is a temporary reference number that an operating system assigns to a file requested by a user to be opened.

portibility

is the ability of a piece of software to move easily from one hardware platform to another

Big Endian

least significant byte has highest address

Little Endian

least significant byte has lowest address

PATH

looking for a program in all of the directories

pointers let you pass by reference

pass "memory location" of variable a way to modify a variable that's in the scope of the caller Callee still receives copy of argument but argument is a *pointer

Reference locality

phenomenon in which a computer program tends to access same set of memory locations for a particular time period.

Virtual memory

process of optimizing RAM storage by borrowing hard drive space a memory management capability of an operating system (OS) that uses hardware and software to allow a computer to compensate for physical memory shortages by temporarily transferring data from random access memory (RAM) to disk storage.

Rules for initialization

static or global variables are given a default value (often zero) and auto storage class variables are indeterminate

Multitasking

support multiple programs at a time

Multiuser

supports multiple users on the system at the same time, each working with their own terminal

Abstraction

the abstraction principle is used to reduce complexity and allow efficient design and implementation of complex software systems. Stirs Asahi complex show simple Performance vs complexity

auto

these are automatically allocated and deallocated variables (local function variables declared on stack) Create when entering functional and delete when existing function

Dynamic typing

this occurs when the run- time environment dynamically applies types to variables as need • Examples: Perl, Python, Ruby, Objective-C Handles types for you, so bad ambiguous code

static typing

this occurs when the type of data is decided at compile time, and type conversion occurs at that time • Examples: C, C++, Java, ...

Type system

type system is a logical system comprising a set of rules that assigns a property called a type to the various constructs of a computer program, such as variables, expressions, functions or modules.

Compiler

uses type information in order to determine how to apply the logical operations defined by the code Defines how different variables can be operated on, and ultimately what machine instructions are generated and executed

Fields

variable definitions ion parts of the struct definition

Environment variables

variable set within the user terminal session (called a shell) • used to setup the environment Ex: use export <VARNAME>=value to create • use echo $<VARNAME> to print • use printevn to print all values

Return array in caller

void copyarray(int src[], int dst[], int size) { int i; for (i = 0; i < size; i++) { dst[i] = src[i]; } }

Sign bit

where the value is interpreted to be positive if it is zero and negative if the value is one.


Kaugnay na mga set ng pag-aaral

mastering A&P ch.22 group 3 modules 22.15-22.24

View Set

Chapter 39: Nutritional Problems

View Set

Chapter 70: Management of Patients With Oncologic or Degenerative Neurologic Disorders

View Set

The Classical Period with Greece and Rome

View Set