Operating Systems Exam 1 Review

02/28/2024

CSCI 480 - Operating Systems - Exam 1 Review Sheet

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.

Additional Readings

Content

  1. Exam Information
  2. Introduction and OS Structures
    1. Operating System Components
    2. System Calls
    3. Linux System Calls
    4. System Programs
  3. Process Management
    1. Process Control Block
    2. Schedulers
    3. Scheduling Queues
    4. Context Switch
    5. Interprocess Communication
    6. Zombie and Orphan Processes
  4. Threads
    1. Differences Between Threads And Processes
    2. Kernel And User Threads
    3. Threading Models
  5. CPU Scheduling
    1. Performance Criteria
    2. Preemptive And Non-Preemptive Scheduling
    3. Scheduling Algorithms
  6. Process Synchronization
    1. Race Condition
    2. Critical Section Problem
    3. Semaphores
  7. Deadlock
  8. Additional Notes

Exam Information

↑ Back to top

Introduction and OS Structures

Operating System Components

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

System Calls

Linux System Calls

getpid() and getppid()

fork()

system() vs execlp()

System Programs

↑ Back to top

Process Management

Process Control Block

Schedulers

Short Term vs Long Term

Degree of Multiprogramming

Medium Term Scheduler

Scheduling Queues

Context Switch

Interprocess Communication

Interprocess Communication

Shared Memory

Message Passing

Zombie and Orphan Processes

Zombie processes

Orphan processes

↑ Back to top

Threads

Differences Between Threads And Processes

ProcessThread
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

Kernel And User Threads

Threading Models

Many-to-One

many to one model image

One-to-One

one to one model image

Many-to-Many

many to many model image

↑ Back to top

CPU Scheduling

Performance Criteria

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

Preemptive and Non-Preemptive Scheduling

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( ).

Non Preemptive

Preemptive

Scheduling Algorithms

First Come First Serve (FCFS)

Shortest Job First (SJF)

Priority

Round Robin

Multi-Level Queue

Multi-Level Feedback

↑ Back to top

Process Synchronization

Race Condition

Critical Section Problem

Semaphores

Implementation

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);
   }
}

↑ Back to top

Deadlock

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.

Prevention

Example of a Deadlock

example of deadlock

↑ Back to top

Additional Notes

↑ Back to top

© 2024 by Ryan Rickgauer