ITFN 2601 Introduction to Operating Systems - PowerPoint PPT Presentation

About This Presentation
Title:

ITFN 2601 Introduction to Operating Systems

Description:

ITFN 2601 Introduction to Operating Systems Lecture 3 Processes, Threads & IPC – PowerPoint PPT presentation

Number of Views:124
Avg rating:3.0/5.0
Slides: 20
Provided by: daniel1575
Category:

less

Transcript and Presenter's Notes

Title: ITFN 2601 Introduction to Operating Systems


1
ITFN 2601Introduction to Operating Systems
  • Lecture 3
  • Processes, Threads
  • IPC

2
Agenda
  • Processes
  • Threads
  • IPC Basics
  • Semaphores Mutex
  • Monitors Barriers
  • Message Passing

3
Why Processes?
  • Separation of Tasks
  • Pseudo-Parallel Execution
  • One Job, One Process

4
Process Fundamentals
  • Creation
  • Implicit (by operating system daemons)
  • Explicit (programmatically, by you)
  • Termination
  • Voluntary (normal or error exit)
  • Involuntary (fatal error or killed by another)

5
Process Internals
  • States
  • Running
  • Ready
  • Blocking
  • Process Control Block
  • State
  • Registers Memory
  • PC, SP, Files

Running
Blocked
Ready
6
Threads?
  • Lightweight Processes
  • Less Individual Information
  • Decomposition of Task
  • User vs. Kernel

7
User vs. Kernel Threads
  • Software Threads
  • No System Calls for Swapping
  • Process-Blocking System Calls
  • Dual-Conflicting Swaps
  • Process Level Thread
  • Kernel Level Process
  • OS Threads
  • Kernel Calls to Swap Threads
  • Thread-Blocking System Calls
  • Dual-Coordinated Swaps
  • Kernel Level Thread
  • Kernel Level Process

8
Hybrid Implementation
  • Scheduler Activation
  • Thread-aware Kernel for User-threads
  • Violates Fundamental Flow-of-Control
  • Upcalls
  • Pop-Up Threading
  • Implicit Thread Creation
  • Receives Message and processes them

9
Process Control
  • Each Process must maintain its own PCB
  • Information that Multiple Processes may use is
    duplicated

10
Thread Control
  • Each Process has a PCB
  • Each Thread has a TCB
  • Shared information is Shared, not Duplicated

11
IPC Basics
  • Race Conditions
  • Critical Region
  • One at a Time
  • Speed Independent
  • Non-Critical Regions Immaterial
  • Finite Waiting
  • Solution?
  • Mutual Exclusion

12
Basic Mutual Exclusion
  • Disable Interrupts (BAD!)
  • Only works for one Processor
  • User must remember to re-enable interrupts
  • Lock Variable (GETTING CLOSER)
  • How do you lock the lock?
  • Lockstep Alternation (ALMOST)
  • Violates 3rd rule of Critical Regions

13
Basic Mutual Exclusion (cont.)
  • Interested Flags
  • Test Set
  • Atomic Action
  • Read Value to see locked
  • Automatically set to locked, just in case
  • Sleep Wakeup

14
Semaphores
  • Tracks number of Sleeps Wakeups
  • Down Up
  • Historically P V Dutch (Thanks, Dijkstra!)
  • Special Cases
  • Down from a 0
  • Process or Thread Sleeps until a new Wakeup
  • Up from 0
  • Random Sleeper for this Wakeup is Triggered

15
Binary Semaphores
  • Mutex
  • Like a Standard Lock
  • Atomicity Provides Self-Locking
  • Idle Wait
  • If Locked, Thread Yields
  • Simpler Semaphores
  • Fundamental Mutual Exclusion Tool

16
Monitors Barriers
  • Monitors
  • Compiler Based Mutual Exclusion
  • Condition Variables
  • Wait
  • Signal
  • Barriers
  • Forced Resynchronization of Processes

17
Barriers
18
Networked Critical Region?
  • How do you enforce Critical Regions across a
    network?
  • Message Passing
  • Each signal is explicitly given a destination
  • Authentication?
  • Acknowledgement of Receipt?

19
Summary
  • Processes Threads allow for pseudo-simultaneous
    execution of tasks
  • Coordination between processes how?
  • Locking Sleeping
  • TSL Command
  • Counting Wakeups
  • Monitors
  • Networked Coordination?
  • Message Passing
  • Barriers
Write a Comment
User Comments (0)
About PowerShow.com