ConcurrencyCS-3013 A-term 20091 Introduction to Concurrency ( Processes, Threads, Interrupts, etc.) CS-3013, Operating Systems A-term 2009 (Slides include.

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

WHAT IS AN OPERATING SYSTEM? An interface between users and hardware - an environment "architecture ” Allows convenient usage; hides the tedious stuff.
Introduction to Operating Systems CS-2301 B-term Introduction to Operating Systems CS-2301, System Programming for Non-majors (Slides include materials.
CMPT 300: Operating Systems I Dr. Mohamed Hefeeda
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,
6/9/2015B.Ramamurthy1 Process Description and Control B.Ramamurthy.
Thursday, June 08, 2006 The number of UNIX installations has grown to 10, with more expected. The UNIX Programmer's Manual, 2nd Edition, June, 1972.
1 School of Computing Science Simon Fraser University CMPT 300: Operating Systems I Dr. Mohamed Hefeeda.
OS Fall ’ 02 Introduction Operating Systems Fall 2002.
1 Process Description and Control Chapter 3. 2 Process Management—Fundamental task of an OS The OS is responsible for: Allocation of resources to processes.
Processes 1 CS502 Spring 2006 Processes Week 2 – CS 502.
OS Spring’03 Introduction Operating Systems Spring 2003.
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.
Process in Unix, Linux and Windows CS-3013 C-term Processes in Unix, Linux, and Windows CS-3013 Operating Systems (Slides include materials from.
1 Last Class: Introduction Operating system = interface between user & architecture Importance of OS OS history: Change is only constant User-level Applications.
Introduction to Synchronization CS-3013 A-term Introduction to Synchronization CS-3013 Operating Systems (Slides include materials from Modern Operating.
Introduction to Synchronization CS-3013 A-term Introduction to Synchronization CS-3013, Operating Systems A-term 2009 (Slides include materials from.
Process Concept An operating system executes a variety of programs
1 Process Description and Control Chapter 3 = Why process? = What is a process? = How to represent processes? = How to control processes?
Process Description and Control A process is sometimes called a task, it is a program in execution.
Processes in Unix, Linux, and Windows CS-502 Fall Processes in Unix, Linux, and Windows CS502 Operating Systems (Slides include materials from Operating.
Concurrency & Synchronization CS-502 Fall Concurrency (continued) and Synchronization CS-502 Operating Systems Fall 2007 (Slides include materials.
Process in Unix, Linux, and Windows CS-3013 A-term Processes in Unix, Linux, and Windows CS-3013 Operating Systems (Slides include materials from.
1 Lecture 4: Threads Operating System Fall Contents Overview: Processes & Threads Benefits of Threads Thread State and Operations User Thread.
Chapter 1. Introduction What is an Operating System? Mainframe Systems
1 Computer System Overview Chapter 1. 2 n An Operating System makes the computing power available to users by controlling the hardware n Let us review.
Silberschatz, Galvin and Gagne  2002 Modified for CSCI 399, Royden, Operating System Concepts Operating Systems Lecture 1 Introduction Read:
Threads Many software packages are multi-threaded Web browser: one thread display images, another thread retrieves data from the network Word processor:
Contact Information Office: 225 Neville Hall Office Hours: Monday and Wednesday 12:00-1:00 and by appointment.
Operating Systems Lecture 2 Processes and Threads Adapted from Operating Systems Lecture Notes, Copyright 1997 Martin C. Rinard. Zhiqing Liu School of.
Chapter 41 Processes Chapter 4. 2 Processes  Multiprogramming operating systems are built around the concept of process (also called task).  A process.
Chapter 3 Process Description and Control
Recall: Three I/O Methods Synchronous: Wait for I/O operation to complete. Asynchronous: Post I/O request and switch to other work. DMA (Direct Memory.
The Functions of Operating Systems Interrupts. Learning Objectives Explain how interrupts are used to obtain processor time. Explain how processing of.
Lecture 3 Process Concepts. What is a Process? A process is the dynamic execution context of an executing program. Several processes may run concurrently,
ConcurrencyCS-502 Fall Concurrency CS-502 Operating Systems Fall 2007 (Slides include materials from Operating System Concepts, 7 th ed., by Silbershatz,
Processes and Process Control 1. Processes and Process Control 2. Definitions of a Process 3. Systems state vs. Process State 4. A 2 State Process Model.
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.
Operating Systems 1 K. Salah Module 1.2: Fundamental Concepts Interrupts System Calls.
Introduction to Concurrency CS-502 (EMC) Fall Introduction to Concurrency ( Processes, Threads, Interrupts, etc.) CS-502, Operating Systems Fall.
© Janice Regan, CMPT 300, May CMPT 300 Introduction to Operating Systems Operating Systems Processes and Threads.
1 Lecture 1: Computer System Structures We go over the aspects of computer architecture relevant to OS design  overview  input and output (I/O) organization.
Lecture on Central Process Unit (CPU)
Chapter 2 Process Management. 2 Objectives After finish this chapter, you will understand: the concept of a process. the process life cycle. process states.
Interrupts and Exception Handling. Execution We are quite aware of the Fetch, Execute process of the control unit of the CPU –Fetch and instruction as.
Copyright © Curt Hill More on Operating Systems Continuation of Introduction.
Silberschatz, Galvin and Gagne ©2009Operating System Concepts – 8 th Edition Chapter 4: Threads.
CSCI/CMPE 4334 Operating Systems Review: Exam 1 1.
Chapter 6 Limited Direct Execution Chien-Chung Shen CIS/UD
CS 3013 & CS 502 Summer 2006 Concurrency & Processes1 CS3013 & CS502 Operating Systems.
Processes and Threads Chapter 3 and 4 Operating Systems: Internals and Design Principles, 6/E William Stallings Patricia Roy Manatee Community College,
Processes and threads.
Intro to Processes CSSE 332 Operating Systems
Processes in Unix, Linux, and Windows
Concurrency CS-3013 Operating Systems C-Term 2008 Assumptions:
Computer System Overview
Processes in Unix, Linux, and Windows
Processor Fundamentals
CS-3013 Operating Systems Hugh C. Lauer
Lecture Topics: 11/1 General Operating System Concepts Processes
Process Description and Control
Multithreaded Programming
Process Description and Control
Process Description and Control
Processes in Unix, Linux, and Windows
CS510 Operating System Foundations
Process Description and Control
Contact Information Office: 225 Neville Hall Office Hours: Monday and Wednesday 12:00-1:00 and by appointment. Phone:
Concurrency & Processes
Presentation transcript:

ConcurrencyCS-3013 A-term Introduction to Concurrency ( Processes, Threads, Interrupts, etc.) CS-3013, Operating Systems A-term 2009 (Slides include materials from Modern Operating Systems, 3 rd ed., by Andrew Tanenbaum and from Operating System Concepts, 7 th ed., by Silbershatz, Galvin, & Gagne)

ConcurrencyCS-3013 A-term Concurrency I.e., things happening at the same time Since the beginning of computing, management of concurrent activity has been the central issue Concurrency between computation and input or output Concurrency between computation and user Concurrency between essentially independent activities that take place at same time Concurrency between parts of large computations that are divided up to improve performance …

ConcurrencyCS-3013 A-term Early 1960s Programmers tried to write programs that would read from input devices and write to output devices in parallel with computing Card readers, paper tape, line printers, etc. Challenges Keeping the buffers organized Synchronizing between I/O activity and computation Computation getting ahead of I/O activity I/O activity getting ahead of computation Definition: buffer – a region of memory from which an I/O device gets data or into which an I/O device puts data

ConcurrencyCS-3013 A-term Mid-late 1960s — Shared Computing Services Multiple simultaneous, independent users of large computing facilities E.g., Time Sharing systems of university computing centers Data centers of large enterprises Multiple accounting, administrative, and data processing activities over common databases …

ConcurrencyCS-3013 A-term Modern Workstations and PCs Multiple windows in personal computer doing completely independent things Word, Excel, Photoshop, , music, etc. Multiple activities within one application –E.g., in Microsoft Word Reading and interpreting keystrokes Formatting line and page breaks Displaying what you typed Spell checking Hyphenation ….

ConcurrencyCS-3013 A-term Modern Game Implementations Multiple characters in game Concurrently & independently active Multiple constraints, challenges, and interactions among characters Multiple players

ConcurrencyCS-3013 A-term Technological Pressure From early 1950s to early 2000s, single processor computers increased in speed by 2  every 18 months or so Moore’s Law Multiprocessing was somewhat of a niche problem I.e., computing systems with more than one CPU Specialized computing centers, techniques

ConcurrencyCS-3013 A-term Technological Pressure (continued) No longer! Modern microprocessor clock speeds are no longer increasing with Moore’s Law Microprocessor density on chips still is!  multi-threaded and multi-core processors are now de facto standard Even on low-end PCs!

ConcurrencyCS-3013 A-term Traditional Challenge for OS Useful set of abstractions that help to –Manage concurrency –Manage synchronization among concurrent activities –Communicate information in useful way among concurrent activities –Do it all efficiently

ConcurrencyCS-3013 A-term Modern Challenge Methods and abstractions to help software engineers and application designers … –Take advantage of inherent concurrency in modern application systems –Exploit multi-processor and multi-core architectures that are becoming ubiquitous –Do so with relative ease

ConcurrencyCS-3013 A-term Fundamental Abstraction Process … aka Task …aka Thread …aka Job …aka [other terms]

ConcurrencyCS-3013 A-term Definition Process (generic) : A particular execution of a particular program. Requires time, space, and (perhaps) other resources Separate from all other executions of the same program Even those at the same time! Separate from executions of other programs

ConcurrencyCS-3013 A-term Process (continued) Can be Interrupted Suspended Blocked Unblocked Started or continued Fundamental abstraction of all modern operating systems Note: “Process” in Unix, Linux, and Windows is a heavyweight concept with more implications than this simple definition

ConcurrencyCS-3013 A-term Process (a generic term – continued) Concept emerged and evolved in 1960s Intended to make sense out of mish-mash of difficult concurrent programming techniques that bedeviled software engineers Analogous to police or taxi dispatcher!

ConcurrencyCS-3013 A-term Background – Interrupts A mechanism in (nearly) all computers by which a running program can be suspended in order to cause processor to do something else Two kinds:– Traps – synchronous, caused by running program –Deliberate: e.g., system call –Error: divide by zero Interrupts – asynchronous, spawned by some other concurrent activity or device. Essential to the usefulness of computing systems

ConcurrencyCS-3013 A-term Hardware Interrupt Mechanism Upon receipt of electronic signal, the processor Saves current PSW to a fixed location Loads new PSW from another fixed location PSW — Program Status Word Program counter Condition code bits (comparison results) Interrupt enable/disable bits Other control and mode information –E.g., privilege level, access to special instructions, etc. Occurs between machine instructions An abstraction in modern processors (see Tanenbaum, §5.1.5)

ConcurrencyCS-3013 A-term Interrupt Handler /* Enter with interrupts disabled */ Save registers of interrupted computation Load registers needed by handler Examine cause of interrupt Take appropriate action (brief) Reload registers of interrupted computation Reload interrupted PSW and re-enable interrupts or Load registers of another computation Load its PSW and re-enable interrupts

ConcurrencyCS-3013 A-term Requirements of interrupt handlers Fast Avoid possibilities of interminable waits Must not count on correctness of interrupted computation Must not get confused by multiple interrupts in close succession … More challenging on multiprocessor systems

ConcurrencyCS-3013 A-term Result Interrupts make it possible to support concurrent activities Don’t help in establishing some kind of orderly way of thinking Need something more

ConcurrencyCS-3013 A-term Hence, emergence of generic concept of process –(or whatever it is called in a particular operating system and environment) Notion of process allows us to abstract interrupts and interleaving and concentrate on each executing program separately

ConcurrencyCS-3013 A-term Information the system needs to implement a process PSW (program status word) Program counter Condition codes Control information – e.g., privilege level, priority, etc Registers, stack pointer, etc. Whatever hardware resources needed to compute Administrative information for OS Owner, restrictions, resources, etc. Other stuff …

ConcurrencyCS-3013 A-term Process Control Block (PCB) (example data structure in an OS)

ConcurrencyCS-3013 A-term Switching from process to process

ConcurrencyCS-3013 A-term Result A very clean way of thinking about separate computations Processes can appear be executing in parallel Even on a single processor machine Processes really can execute in parallel Multi-processor, multi-core, or multi-threaded hardware …

ConcurrencyCS-3013 A-term Process States

ConcurrencyCS-3013 A-term The Fundamental Abstraction of the OS Each process has its “virtual” processor Each process can be thought of as an independent computation On a fast enough physical processor, processes can look like they are really running concurrently

ConcurrencyCS-3013 A-term Questions?

ConcurrencyCS-3013 A-term Implementation of Processes Ready queue PCB or Ready queue1 PCB Ready queue1 PCB Ready queue2 PCB Ready queuen PCB …

ConcurrencyCS-3013 A-term Implementation Action – dispatch a process to CPU Remove first PCB from ready queue Load registers and PSW Return from interrupt or trap Action – interrupt a process Save PSW and registers in PCB If not blocked, insert PCB back into ReadyQueue (in some order); otherwise, link it to some other queue or list Take appropriate action Dispatch same or another process from ReadyQueue Ready queue PCB

ConcurrencyCS-3013 A-term Timer interrupts Can be used to enforce “fair sharing” Current process goes back to ReadyQueue After other processes of equal or higher priority Simulates concurrent execution of multiple processes on same processor

ConcurrencyCS-3013 A-term Processes – Switching When a process is running, its hardware state is in the processor – PC, processor registers, etc. When the OS suspends running a process, it saves the hardware state in the PCB When the OS dispatches a process, it restores the hardware state from the PCB

ConcurrencyCS-3013 A-term Definition – Context Switch The act of switching from one process to another E.g., upon interrupt or some kind of wait for event Not a big deal in simple systems and processors Very big deal in large systems such Linux and Windows Pentium 4, etc. Many microseconds!

ConcurrencyCS-3013 A-term Definition — Scheduling The art and science of deciding which process to dispatch next … … and for how long … … and on which processor Topic for later in this course

ConcurrencyCS-3013 A-term Questions? Next Topic