This is a study guide I wrote to help myself review for my first exam in my operating systems class. The majority of information used to write this guide comes from our textbook. I tried to cover all the topics listed on the review sheet.
User Interface | means by which users can issue commands to the system |
Program Execution | the OS must be able to load a program into RAM, run the program, and terminate the program, either normally or abnormally |
I/O Operations | transferring data to and from I/O devices, including keyboards, terminals, printers, and storage devices |
File-System Manipulation | maintaining directory and subdirectory structures, mapping file names to specific blocks of data storage, and providing tools for navigating and utilizing the file system |
Communications | inter-process communications, IPC, either between processes running on the same processor, or between processes running on separate processors or separate machines |
Error Detection | both hardware and software errors must be detected and handled appropriately, with a minimum of harmful repercussions |
getpid()
returns the process id of the calling processgetppid()
returns the process id of the parent of the calling processfork()
creates a new process (a child of the calling process) by duplicating the calling processsystem()
internally uses a fork and executes in the child processexeclp()
replaces the executable code for what its doing
provide OS functionality through separate applications, which are not part of the kernel or command interpreters
also known as system utilities or system applications
can be provided into these categories:
file management | programs to create, delete, copy, rename, print, list, and generally manipulate files and directories |
status information | utilities to check on the date, time, number of users, processes running, data logging, etc. |
file modification | text editors and other tools which can change file contents. |
programming language support | compilers, linkers, debuggers, profilers, assemblers, library archive management, interpreters for common languages, and support for make. |
program loading and execution | loaders, dynamic loaders, overlay loaders, etc., as well as interactive debuggers. |
communications | programs for providing connectivity between processes and users, including mail, web browsers, remote logins, file transfers, and remote command execution. |
background services | system daemons are commonly started when the system is booted, and run for as long as the system is running, handling necessary services |
new | the process is being created |
ready | the process is waiting to be assigned to a processor |
running | instructions are being executed |
waiting | the process is waiting for some event to occur |
terminated | the process has finished execution |
a process control block (PCB) represents each process in the operating system
process state | can be new, ready, running, waiting, etc... |
program counter | indicates the addess of the next instruction to be executed in this process |
cpu registers | can include accumulators, index registers, stack pointers, and general purpose registers |
cpu scheduling info | includes a process priority, pointers to scheduling queues, and other scheduling parameters |
memory management info | may include the value of the base and limit registers, page tables |
accounting info | amount of cpu and real time used, time limits, account numbers, job and process numbers |
I/O status | the list of I/O devices allocated to the process, a list of open files |
Process | Thread |
---|---|
typically independent | Subset of a process |
has considerably more state information than thread | multiple threads within a process |
separate address spaces | share their address space |
interact only through system IPC |
Criteria | Description |
---|---|
CPU Utilization | percentage of used cycles |
Throughput | jobs completed per time unit |
Turnaround Time | time from submission to completion |
Waiting Time | time waiting in ready queue |
Response Time | time from submission until first response |
Non Preemptive | Preemptive |
---|---|
When a process switches from the running state to the waiting state, such as for an I/O request or invocation of the wait( ) system call. | When a process switches from the running state to the ready state, for example in response to an interrupt. |
When a process terminates. | When a process switches from the waiting state to the ready state, say at completion of I/O or a return from wait( ). |
Define a semaphore as a "C" struct:
typedef struct {
int value;
struct process *list;
} semaphore;
The wait()
semaphore operation can now be defined as:
wait(semaphore *S) {
S->Value--;
if (S->Value < 0) {
add this process to S->list;
block();
}
}
The post()
semaphore operation can now be defined as:
post(semaphore *S) {
S->Value++;
if (S->Value <= 0) {
remove a process P from S->list;
wakeup(P);
}
}
There are four necessary conditions for deadlock.
Mutual Exclusion | The resources involved are non-shareable |
Hold and Wait | A process must be simultaneously holding at least one resource and waiting for at least one resource that is currently being held by some other process. |
No Preemption | Once a process is holding a resource then that resource cannot be taken away from that process until the process voluntarily releases it. |
Circular Wait | The processes in the system form a circular list or chain where each process in the list is waiting for a resource held by the next process in the list. |
© 2024 by Ryan Rickgauer