Processes and Threads
Terms
undefined, object
copy deck
- The function name, the type each parameter, and return type
- Function signature
- Allows the concurrent execution of threads from multiple processes. Gives the illusion that each process has the machine to itself.
- Multiprogramming
- Given the CPU to execute machine instructions in a program, resides within the address space of the process; The "dispatchable" unit
- Thread
- The longest time interval a thread can have the CPU before the OS regains control
- Timeslice
- Program that has an address space and resources
- Process
- Owns the address space
- Process
- Gets the cpu
- thread
- Clock generated hardware event which transfers control to an ISR
- Interrupt
- Guarantees the OS to regain control within a certain time interval
- ISR (Interrupt Support Routine)
- Saving the state of a thread from a process and restoring the state of another thread from a process (could be the same or a different process)
- Context Switching
- Program counter, register set, and condition codes of a thread
- State
- Has clock-interrupt-isr-dispatch sequence
- Pre-emptive multiprogramming
- Relies on each thread to voluntarily relinquish the CPU
- Non-preemptive multiprogramming
- To be an OS the multiprogramming environment must be
- Pre-emptive
- Retreives directory info
- opendir
- Returns file names in a directory
- readdir
- C-language string resides within
- array of chars
- String array ends with a
- null char, \0
- Synchronous events that are responses of the CPU to conditions detected during the execution of an instruction (such as an error)
- Exceptions
- Asynchronous events triggered by controllers whose devices need attention, or by the clock
- Interrupts
- A situation where several processes access and manipulate the same data concurrently and the outcome of execution depends on the particular order in which the access takes place
- Race Conditions
- %d %i %o %s
- decimal, integer, hex, string
- malloc
- memory allocation, instantiate a variable to reserve a memory area
-
stat(path, buf)
buf->st_size
buf->st_mode -
Get the statistics for a file, use this path, put it in that buffer.
st_size = size of stat
st_mode = mode of stat
chmod = change mode - System call causes a new process to be created, having a copy of the address space of the original process.
- Fork
- Creates an I/O mechanism and returns (takes in and modifies) two file descriptors. Successful completion returns a 0.
- Pipe