Presentation is loading. Please wait.

Presentation is loading. Please wait.

Introduction to Operating Systems

Similar presentations


Presentation on theme: "Introduction to Operating Systems"— Presentation transcript:

1 Introduction to Operating Systems
CPSC/ECE 3220 Spring 2020 Lecture Notes OSPP Chapter 4 – Part B (adapted by Mark Smotherman from Tom Anderson’s slides on OSPP web site)

2 Threads at User and Kernel Level
Multiple single-threaded processes System calls access shared kernel data structures Multiple multi-threaded user processes Each with multiple threads, sharing same data structures, isolated from other user processes Kernel design Kernel can have zero threads (e.g., IBM MVT) Kernel can use internal threads In general, interrupt handlers are not threads but can be used to wake or signal threads

3 Multithreaded OS Kernel

4 Multithreaded User Processes (Take 1)

5 Multithreaded User Processes (Take 2)
Green threads (early Java) User-level library, within a single-threaded process Library does thread context switch Preemption via upcall/UNIX signal on timer interrupt Use multiple processes for real concurrency Shared memory region mapped into each process

6 Multithreaded User Processes (Take 3)
Scheduler activations (Windows 8) Kernel allocates processors to user-level library Thread library implements context switch Thread library decides what thread to run next Upcall whenever kernel needs a user-level scheduling decision Process assigned a new processor Processor removed from process System call blocks in kernel

7 Asynchronous I/O as a Alternative to Threads

8 Event-Driven Approach
Ousterhout description: One execution sequence; no concurrency Establish callbacks for events Event loop waits for an event and invokes handlers No preemption of event handlers Event handlers are generally short-lived But must add “continuation” data structures if event processing is complex and needs local state and tracking of next step

9 Question When is event-driven programming better than multithreaded concurrency? Why?


Download ppt "Introduction to Operating Systems"

Similar presentations


Ads by Google