Operating Systems CMPSC 473 Processes (3) September 17 2008 - Lecture 9 Instructor: Bhuvan Urgaonkar.

Slides:



Advertisements
Similar presentations
Processes and Threads Chapter 3 and 4 Operating Systems: Internals and Design Principles, 6/E William Stallings Patricia Roy Manatee Community College,
Advertisements

Chapter 3 Process Description and Control
Threads, SMP, and Microkernels Chapter 4. Process Resource ownership - process is allocated a virtual address space to hold the process image Scheduling/execution-
Threads Irfan Khan Myo Thein What Are Threads ? a light, fine, string like length of material made up of two or more fibers or strands of spun cotton,
Chapter 4: Threads. Overview Multithreading Models Threading Issues Pthreads Windows XP Threads.
Chapter 5 Processes and Threads Copyright © 2008.
Figure 2.8 Compiler phases Compiling. Figure 2.9 Object module Linking.
Introduction to Kernel
Advanced OS Chapter 3p2 Sections 3.4 / 3.5. Interrupts These enable software to respond to signals from hardware. The set of instructions to be executed.
Operating Systems Lecture # 3. Recap Hardware Operating System Application System Call Trap Hardware Trap Processor.
CS-502 Fall 2006Processes in Unix, Linux, & Windows 1 Processes in Unix, Linux, and Windows CS502 Operating Systems.
Unix & Windows Processes 1 CS502 Spring 2006 Unix/Windows Processes.
Chapter 4: Threads. 4.2 Silberschatz, Galvin and Gagne ©2005 Operating System Concepts Objectives Thread definitions and relationship to process Multithreading.
1 Process Description and Control Chapter 3 = Why process? = What is a process? = How to represent processes? = How to control processes?
A. Frank - P. Weisberg Operating Systems Threads Implementation.
1 Threads Chapter 4 Reading: 4.1,4.4, Process Characteristics l Unit of resource ownership - process is allocated: n a virtual address space to.
Processes in Unix, Linux, and Windows CS-502 Fall Processes in Unix, Linux, and Windows CS502 Operating Systems (Slides include materials from Operating.
ThreadsThreads operating systems. ThreadsThreads A Thread, or thread of execution, is the sequence of instructions being executed. A process may have.
Chapter 51 Threads Chapter 5. 2 Process Characteristics  Concept of Process has two facets.  A Process is: A Unit of resource ownership:  a virtual.
Processes Part I Processes & Threads* *Referred to slides by Dr. Sanjeev Setia at George Mason University Chapter 3.
Operating Systems CSE 411 CPU Management Sept Lecture 11 Instructor: Bhuvan Urgaonkar.
Process Description and Control Chapter 3. Major Requirements of an OS Interleave the execution of several processes to maximize processor utilization.
Operating Systems CMPSC 473 Threads September 16, Lecture 7 Instructor: Bhuvan Urgaonkar.
Silberschatz, Galvin and Gagne ©2011Operating System Concepts Essentials – 8 th Edition Chapter 4: Threads.
CSC 501 Lecture 2: Processes. Process Process is a running program a program in execution an “instantiation” of a program Program is a bunch of instructions.
Three fundamental concepts in computer security: Reference Monitors: An access control concept that refers to an abstract machine that mediates all accesses.
Processes and Threads Processes have two characteristics: – Resource ownership - process includes a virtual address space to hold the process image – Scheduling/execution.
Operating Systems CMPSC 473 Processes (4) September Lecture 10 Instructor: Bhuvan Urgaonkar.
Lecture 3 Process Concepts. What is a Process? A process is the dynamic execution context of an executing program. Several processes may run concurrently,
Hardware process When the computer is powered up, it begins to execute fetch-execute cycle for the program that is stored in memory at the boot strap entry.
Threads, SMP, and Microkernels Chapter 4. Process Resource ownership - process is allocated a virtual address space to hold the process image Scheduling/execution-
Operating Systems CSE 411 Multi-processor Operating Systems Multi-processor Operating Systems Dec Lecture 30 Instructor: Bhuvan Urgaonkar.
Multiprogramming. Readings r Silberschatz, Galvin, Gagne, “Operating System Concepts”, 8 th edition: Chapter 3.1, 3.2.
Operating Systems CMPSC 473 Lecture 8: Threads September Instructor: Bhuvan Urgaonkar.
Operating Systems CMPSC 473 Processes August 31, Lecture 3 Instructor: Bhuvan Urgaonkar.
Chapter 4: Threads. 4.2 Silberschatz, Galvin and Gagne ©2005 Operating System Concepts – 7 th edition, Jan 23, 2005 Chapter 4: Threads Overview Multithreading.
We will focus on operating system concepts What does it do? How is it implemented? Apply to Windows, Linux, Unix, Solaris, Mac OS X. Will discuss differences.
4300 Lines Added 1800 Lines Removed 1500 Lines Modified PER DAY DURING SUSE Lab.
Operating Systems CSE 411 CPU Management Sept Lecture 10 Instructor: Bhuvan Urgaonkar.
Concurrency, Processes, and System calls Benefits and issues of concurrency The basic concept of process System calls.
Processes, Threads, and Process States. Programs and Processes  Program: an executable file (before/after compilation)  Process: an instance of a program.
© Janice Regan, CMPT 300, May CMPT 300 Introduction to Operating Systems Operating Systems Processes and Threads.
Processes & Threads Introduction to Operating Systems: Module 5.
Hardware process When the computer is powered up, it begins to execute fetch-execute cycle for the program that is stored in memory at the boot strap entry.
CSC 660: Advanced Operating Systems
Operating Systems CMPSC 473 Signals, Introduction to mutual exclusion September 28, Lecture 9 Instructor: Bhuvan Urgaonkar.
Cs431-cotter1 Processes and Threads Tanenbaum 2.1, 2.2 Crowley Chapters 3, 5 Stallings Chapter 3, 4 Silberschaz & Galvin 3, 4.
What is a Process ? A program in execution.
Lecture 5 Rootkits Hoglund/Butler (Chapters 1-3).
Operating Systems CMPSC 473 Processes (5) September Lecture 11 Instructor: Bhuvan Urgaonkar.
1 Threads, SMP, and Microkernels Chapter 4. 2 Process Resource ownership - process includes a virtual address space to hold the process image Scheduling/execution-
CSCI/CMPE 4334 Operating Systems Review: Exam 1 1.
Silberschatz, Galvin and Gagne ©2009Operating System Concepts – 8 th Edition Chapter 4: Threads.
Processes and threads.
Process concept.
Operating Systems CMPSC 473
Process Management Process Concept Why only the global variables?
Mechanism: Limited Direct Execution
Operating Systems: A Modern Perspective, Chapter 6
Intro to Processes CSSE 332 Operating Systems
Threads & multithreading
Chapter 4: Threads.
Threads, SMP, and Microkernels
Lecture 4- Threads, SMP, and Microkernels
Threads Chapter 4.
CHAPTER 4:THreads Bashair Al-harthi OPERATING SYSTEM
Implementing Processes, Threads, and Resources
Processes David Ferry, Chris Gill, Brian Kocoloski
Lecture 10 review Booting sequence in Brief
Threads CSE 2431: Introduction to Operating Systems
Presentation transcript:

Operating Systems CMPSC 473 Processes (3) September Lecture 9 Instructor: Bhuvan Urgaonkar

Announcements Suggested Reading for this lecture: Sections Quiz 1: Will have several questions that came up during previous lectures

Overview of Process- related Topics How a process is born –Parent/child relationship –fork, clone, … How it leads its life –Loaded: Later in the course –Executed CPU scheduling Context switching Where a process “lives”: Address space –OS maintains some info. for each process: PCB –Process = Address Space + PCB How processes request services from the OS –System calls How processes communicate Some variants of processes: LWPs and threads How processes die

Overview of Process- related Topics How a process is born –Parent/child relationship –fork, clone, … How it leads its life –Loaded: Later in the course –Executed CPU scheduling Context switching Where a process “lives”: Address space –OS maintains some info. for each process: PCB –Process = Address Space + PCB How processes request services from the OS –System calls How processes communicate Some variants of processes: LWPs and threads How processes die more today

The Process/Kernel Model Transitions between User and Kernel modes: An example Process 1 USER MODE KERNEL MODE Process 1Process 2 Time Sys call handler Scheduler Interrupt handler

Re-entrant Kernels Note: Not showing scheduler invocations Re-entrant kernel: Several processes may be in Kernel Mode at the same time –A re-entrant kernel is able to suspend the current running process even if it is in the Kernel Mode Note: Traps are a type of exceptions. We will encounter more types later. Process 1 USER MODE KERNEL MODE Process 1Process 2 Time ExcpIntr

Re-entrant Kernels Note: Not showing scheduler invocations Re-entrant kernel: Several processes may be in Kernel Mode at the same time –A re-entrant kernel is able to suspend the current running process even if it is in the Kernel Mode Process 1 USER MODE KERNEL MODE Process 1Process 2 Time ExcpIntr Kernel control paths

Re-entrant Kernels Note: Not showing scheduler invocations Re-entrant kernel: Several processes may be in Kernel Mode at the same time –A re-entrant kernel is able to suspend the current running process even if it is in the Kernel Mode A kernel control path denotes the sequence of instructions executed by the kernel to handle a system call, an exception, or an interrupt Process 1 USER MODE KERNEL MODE Process 1Process 2 Time ExcpIntr Kernel control paths

Re-entrant Kernels Note: Not showing scheduler invocations Why re-entrancy? Process 1 USER MODE KERNEL MODE Process 1Process 2 Time ExcpIntr Kernel control paths

Re-entrant Kernels Note: Not showing scheduler invocations Why re-entrancy? –Improves throughput of devices controllers that raise interrupts –Allows priorities among interrupts Process 1 USER MODE KERNEL MODE Process 1Process 2 Time ExcpIntr Kernel control paths

Realizing re-entrancy: Take 1 Write kernel functions that only modify local variables and do not alter global variables –Re-entrant functions Pros and Cons?

Take 1: Write kernel functions that only modify local variables and do not alter global variables –Re-entrant functions Pros/Cons –Simplifies/complicates kernel programming (?) Realizing re-entrancy: Take 1

Realizing re-entrancy: Take 2 Kernel Mode Stacks We know: a process running in User Model refers to its private stack To allow re-entrancy, there is a Kernel Mode Stack for each process Each kernel control path uses its own private kernel stack Kept in part of RAM reserved for the kernel

Kernel Mode Stack PCB (task_struct) Stack KM stack and PCB need to be able to find each other KM stack must have access to a pointer to the PCB esp

Kernel Mode Stack thread_info structure PCB (task_struct) esp curent Stack KM stack and PCB need to be able to find each other KM stack must have access to a pointer to the PCB –Linux: thread_info PCB must have access to KM stack task

Kernel Mode Stack thread_info structure PCB (task_struct) esp curent Stack KM stack and PCB need to be able to find each other KM stack must have access to a pointer to the PCB –Linux: thread_info PCB must have access to KM stack thread_info task

Kernel Mode Stack thread_info structure PCB (task_struct) esp curent Stack Since KM stacks make little use of the stack, only a few thousand bytes suffice –An example of “Design for the most common case”, we’ll see more –Linux: 8KB, thread_info 52 bytes thread_info task

Kernel Mode Stack thread_info structure PCB (task_struct) esp curent Stack Since KM stacks make little use of the stack, only a few thousand bytes suffice –An example of “Design for the most common case”, we’ll see more –Linux: 8KB Why combine KM stack and thread_info into a union? thread_info union thread_union { struct thread_info thread_info; unsigned long stack[2048]; }; task

Kernel Mode Stack thread_info structure PCB (task_struct) esp curent Stack Since KM stacks make little use of the stack, only a few thousand bytes suffice –An example of “Design for the most common case”, we’ll see more –Linux: KM Stack 8KB, thread_info 52 bytes Why combine KM stack and thread_info into a union? –You might think spatial locality –The kernel can easily obtain the address of the thread_info structure of the process currently running on the CPU from the value of the esp register –task field is at offset 0 –Other benefits apply to multi-processors: makes it easy to efficiently find the current process on each processor Earlier approach: Have an array of current pointers thread_info task union thread_union { struct thread_info thread_info; unsigned long stack[2048]; };

Enumerating # Possible CPU Multiplexing Between Processes Consider two processes P1 and P2 –P1: n instructions –P2: m instructions –No jump instrictions => No loops How many unique executions are possible?