Operating Systems (3-4)

0.0(0)
Studied by 0 people
call kaiCall Kai
learnLearn
examPractice Test
spaced repetitionSpaced Repetition
heart puzzleMatch
flashcardsFlashcards
GameKnowt Play
Card Sorting

1/31

encourage image

There's no tags or description

Looks like no tags are added yet.

Last updated 4:35 PM on 10/2/26
Name
Mastery
Learn
Test
Matching
Spaced
Call with Kai
Chat

No analytics yet

Send a link to your students to track their progress

32 Terms

1
New cards

Process Scheduler

  • Selects among available processes for next execution on CPU

  • Maximizes CPU use


2
New cards

Join() System Call

  • Suspension: The parent process or main thread pauses execution.

  • Waiting: It waits until a specific child or thread finishes task.

  • Resumption: Once the child exits or terminates, the parent collects its exit status and resumes


3
New cards

Context Switch

  • When the CPU switches from one process to another

  • Must save the state of the old process and then load the saved state for the new process


<ul><li><p>When the CPU switches from one process to another</p></li><li><p>Must save the state of the old process and then load the saved state for the new process</p></li></ul><p></p>
4
New cards

Child process

  • Created from the parent process

  • If one has an error then parent aborts one without shutting down the whole system


  • Inherits:

    • Shared memory segments

    • Environment variables

    • Parent resources


5
New cards

Fork() System Call


  • Creates a new process splitting from the parent


6
New cards

Exec() System Call

  • Used after fork() to replace the process’ memory space with a new program


  • Replaces the current program's code, data, heap, and stack with those of the new program.

  • The process itself remains, including its PID and other process-level attributes


7
New cards

Abort() System Call

  • Parent can terminate the execution of children process using this system call

  • Reasons:

    • Child has exceeded allocated resouces

    • Task assigned to child is not required anymore

    • The parent is exiting children can’t exist on their own


8
New cards

Cascading Termincation

  • All children and grandchildren are terminated

  • Initiated by OS


9
New cards

Shared Memory (IPC)

  • An area of memory is used among the process that need to communicate

  • Under control of the users’ process not the OS

  • They need to synchronize their actions so they don’t write to the same location


10
New cards

Message Passing (IPC)

  • Processes communicate with each other without sharing variables

  • Provides send(message) and receive(message) operations

  • Message size is either fixed or variable


11
New cards

Race Condition

  • Happens when multiple processes or threads access and change shared data at the same time

  • What can happen:

    • Data corruption

    • Security Risks

      • Hackers can exploit timing gaps


12
New cards

Direct Communication

  • For processes to communicate with each other they must name each other explicitly


  • send(P, message) - send a message to process P

  • receive(Q, message) - receive a message from process Q


  • Communication links are established automatically

  • There’s only 1 link between a pair of processes


13
New cards

Indirect Communication

  • Messages between processes are directed and received from mailboxes (also known as ports)

  • Mailbox has unique ID


  • send(A, message) - send a message to mailbox A

  • receive(A, message) - receive a message from mailboxes A


  • Communication

    • Communication link established only if processes share a common mailbox

    • A link can be associated with many processes

    • Link can be uni-directional or bi-directional


14
New cards

Blocking Message Passing

  • Message passing may be either blocking or non-blocking

    • Synchronous


  • Send - the sender is blocked until the message is received

  • Receive - the receiver is blocked until a message is available


  • If both send and receive are blocking then its a rendezvous!


15
New cards

Non-blocking Message Passing

  • Message passing may be either blocking or non-blocking

    • Asynchronous


  • Send

    • The sender sends the message and continues

  • Receive

    • The receiver receives:

      • A valid message or

      • A null message


16
New cards

Multi-threaded Benefits

  • Responsiveness

    • May allow continued execution if part of process is blocked

  • Resource Sharing

    • Threads share resources of process

  • Economy

    • Cheaper than process creation, thread switching

  • Scalability

    • Process can take advantage of multicore architectures


17
New cards

Threads

  • The smallest unit of execution within a process

  • While a process holds the application’s memory and resources, this handles the actual execution

  • Contains:

    • Tracks the next instruction to run

    • Holds current working variables

  • Switching between these takes less time than a full process


18
New cards

Multicore Programming

  • Puts pressure on programmers with challenges such as:

    • Dividing activities

    • Balance

    • Data Splitting

    • Testing and Debugging

  • Can be used to speed up evaluations by separating parts to other cores


19
New cards

Parallelism

  • Implies a system can preform more than one task simultaneously

  • Multi-core system


20
New cards

Data Parallelism

  • A type of parallelism

  • Distributes subsets of the same data across multiple cores (same operation on each)


21
New cards

Task Parallelism

  • A type of parallelism

  • Distributes threads across cores, each thread performing unique operation


22
New cards

Concurrency

  • Supports more than one task making progress by sharing single processor resources

  • Single Processor / core


23
New cards

Amdahl’s Law

  • Identifies performance gains from adding additional cores to an application that has serial and parallel components

  • S is serial portion

  • N is processing cores


<ul><li><p>Identifies performance gains from adding additional cores to an application that has serial and parallel components</p></li><li><p>S is serial portion</p></li><li><p>N is processing cores</p></li></ul><p></p>
24
New cards

User Threads

  • A thread of execution managed entirely by application-level thread libraries in user space.

  • OS kernel unaware of existence


25
New cards

Kernel Threads

  • A basic unit of execution that is managed directly by the OS kernel


26
New cards

Asynchronous Thread Cancellation

  • Terminates the target thread immediately


27
New cards

Deferred Thread Cancellation (or Synchronous)

  • Allows the target thread to periodically check if it should be cancelled


28
New cards

1-to-1 Multithreading Model

  • Each user-level thread maps to kernel thread

  • Advantages:

    • True parallelism

    • Non-blocking: other threads keep running if another is blocking

    • Maximizes performance on multi-core processors

  • Disadvantages:

    • High overhead: A lot of memory and time is used

    • Resource limits: kernel management takes more resources


29
New cards

Zombie Process

  • A terminated child process that remains in the process table because it’s parent. process has not yet read it’s exit status


30
New cards

Orphan Process

A running child process whose parent process has finished, crashed, or terminated before the child finished execution

31
New cards

Many-to-Many Multithreaded Model

  • Many user-level threads to an equal or smaller number of kernel-level threads\


  • Benefits:

    • Can create as many user threads as needed and the system maps them to kernel threads

    • Efficiency: Avoids heavy kernel overhead since management happens mostly in user space


  • Disadvantages:

    • Complex Implementation

    • Scheduling overhead


32
New cards

Many-to-1 Multithreading Model

  • Maps many user-level threads to a single kernel-level thread


  • Advantages:

    • Thread switching and management is very fast because they avoid system calls

    • Low Overhead


  • Disadvantages:

    • If one user-thread is waiting for input then the entire process stops

    • No true parallelism