Intro to Multiprocessing

Slides:



Advertisements
Similar presentations
CSC 501 Lecture 2: Processes. Von Neumann Model Both program and data reside in memory Execution stages in CPU: Fetch instruction Decode instruction Execute.
Advertisements

Processes CSCI 444/544 Operating Systems Fall 2008.
Review: Process Management Objective: –Enable fair multi-user, multiprocess computing on limited physical resources –Security and efficiency Process: running.
CPU Scheduling. Schedulers Process migrates among several queues –Device queue, job queue, ready queue Scheduler selects a process to run from these queues.
CS 300 – Lecture 22 Intro to Computer Architecture / Assembly Language Virtual Memory.
Process in Unix, Linux and Windows CS-3013 C-term Processes in Unix, Linux, and Windows CS-3013 Operating Systems (Slides include materials from.
CPS110: Implementing threads/locks on a uni-processor Landon Cox.
Threads CS 416: Operating Systems Design, Spring 2001 Department of Computer Science Rutgers University
Scheduler Activations Jeff Chase. Threads in a Process Threads are useful at user-level – Parallelism, hide I/O latency, interactivity Option A (early.
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.
Object Oriented Analysis & Design SDL Threads. Contents 2  Processes  Thread Concepts  Creating threads  Critical sections  Synchronizing threads.
1 Scheduling Processes. 2 Processes Each process has state, that includes its text and data, procedure call stack, etc. This state resides in memory.
CS 346 – Chapter 1 Operating system – definition Responsibilities What we find in computer systems Review of –Instruction execution –Compile – link – load.
Computer Architecture and Operating Systems CS 3230: Operating System Section Lecture OS-1 Process Concepts Department of Computer Science and Software.
1 RTOS Design Some of the content of this set of slides is taken from the documentation existing on the FreeRTOS website
Dr. R R DOCSIT, Dr BAMU. Basic Java : Multi Threading 2 Objectives of This Session State what is Multithreading. Describe the life cycle of Thread.
Lecture 3 Process Concepts. What is a Process? A process is the dynamic execution context of an executing program. Several processes may run concurrently,
What Every Developer Should Know about the Kernel Dr. Michael L. Collard 1.
Scheduling Lecture 6. What is Scheduling? An O/S often has many pending tasks. –Threads, async callbacks, device input. The order may matter. –Policy,
2.5 Scheduling Given a multiprogramming system. Given a multiprogramming system. Many times when more than 1 process is waiting for the CPU (in the ready.
Lecture 7: Scheduling preemptive/non-preemptive scheduler CPU bursts
CPS110: Implementing threads Landon Cox. Recap and looking ahead Hardware OS Applications Where we’ve been Where we’re going.
1 Review of Process Mechanisms. 2 Scheduling: Policy and Mechanism Scheduling policy answers the question: Which process/thread, among all those ready.
Cpr E 308 Spring 2005 Process Scheduling Basic Question: Which process goes next? Personal Computers –Few processes, interactive, low response time Batch.
Process Models, Creation and Termination Reference –text: Tanenbaum ch. 2.1.
Concurrency & Context Switching Process Control Block What's in it and why? How is it used? Who sees it? 5 State Process Model State Labels. Causes of.
1 Computer Systems II Introduction to Processes. 2 First Two Major Computer System Evolution Steps Led to the idea of multiprogramming (multiple concurrent.
1  process  process creation/termination  context  process control block (PCB)  context switch  5-state process model  process scheduling short/medium/long.
Processes, Threads, and Process States. Programs and Processes  Program: an executable file (before/after compilation)  Process: an instance of a program.
2.5 Scheduling. Given a multiprogramming system, there are many times when more than 1 process is waiting for the CPU (in the ready queue). Given a multiprogramming.
© Janice Regan, CMPT 300, May CMPT 300 Introduction to Operating Systems Operating Systems Processes and Threads.
CS 390 Unix Programming Environment
Lecture Topics: 11/15 CPU scheduling: –Scheduling goals and algorithms.
Slides created by: Professor Ian G. Harris Operating Systems  Allow the processor to perform several tasks at virtually the same time Ex. Web Controlled.
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.
CPU Scheduling CS Introduction to Operating Systems.
Lecturer 5: Process Scheduling Process Scheduling  Criteria & Objectives Types of Scheduling  Long term  Medium term  Short term CPU Scheduling Algorithms.
Scheduling.
Lecture 5 Page 1 CS 111 Online Process Creation Processes get created (and destroyed) all the time in a typical computer Some by explicit user command.
1 Module 3: Processes Reading: Chapter Next Module: –Inter-process Communication –Process Scheduling –Reading: Chapter 4.5, 6.1 – 6.3.
CS 162 Discussion Section Week 2. Who am I? Prashanth Mohan Office Hours: 11-12pm Tu W at.
Threads prepared and instructed by Shmuel Wimer Eng. Faculty, Bar-Ilan University 1July 2016Processes.
CPU Scheduling Scheduling processes (or kernel-level threads) onto the cpu is one of the most important OS functions. The cpu is an expensive resource.
Multiprogramming. Readings r Chapter 2.1 of the textbook.
CPU SCHEDULING.
Process Management Process Concept Why only the global variables?
CS 6560: Operating Systems Design
Copyright ©: Nahrstedt, Angrave, Abdelzaher
Threads and Scheduling
Process Management Presented By Aditya Gupta Assistant Professor
April 6, 2001 Gary Kimura Lecture #6 April 6, 2001
Process Creation Processes get created (and destroyed) all the time in a typical computer Some by explicit user command Some by invocation from other running.
Chapter 3: Processes.
Intro to Processes CSSE 332 Operating Systems
Process management Information maintained by OS for process management
Chapter 1: Intro (excerpt)
Chapter 6: CPU Scheduling
Chapter 5: CPU Scheduling
Process Models, Creation and Termination
CS 143A Quiz 1 Solution.
Multithreading.
Process & its States Lecture 5.
CS/COE 0449 Jarrett Billingsley
Threads and Concurrency
Race conditions and Synchronization
CPU scheduling decisions may take place when a process:
February 5, 2004 Adrienne Noble
Programs – Loading and Running an Executable
- When you approach operating system concepts there might be several confusing terms that may look similar but in fact refer to different concepts:  multiprogramming, multiprocessing, multitasking,
CS703 – Advanced Operating Systems
Presentation transcript:

Intro to Multiprocessing CS/COE 0449 (term 2184) Jarrett Billingsley

Class announcements don't forget… project 3 is due next Wednesday night OMET completion is at 20% 15 responses out of 56 needed for cookies step up your game CS449 (2184)

Multiprocessing CS449 (2184)

Where'd it come from? computers used to be huge like.. physically and therefore expensive like.. millions of dollars so many people had to be able to share one computer at once like.. thoth multiprocessing is: running multiple processes (programs) at the same time on one computer CS449 (2184)

And then they got small personal computers (PCs) weren't A Thing until the 1970s, and weren't really popular until well into the 1980s limited and basic at first, but… CS449 (2184)

Scheduling CS449 (2184)

AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA All my children at any given time, there are dozens or hundreds of processes running Code Memory Process 1 my turn! my turn!!! I'm the ONLY process! that means I'm the BEST! Code Memory Process 173 Kernel AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA Code Memory Process 9 Code Memory Process 92 I want all the CPU!! no I want all the CPU!! CS449 (2184)

we call these CPU-bound we call these IO-bound Who's who some processes use LOTS OF CPU other just sit around most of the time, waiting for input or output (I/O) enter your choice: rock the computer chose rock. tie! enter your choice: paper the computer chose rock. you win! you: 1, computer: 0 enter your choice: _ g++ somefile.cpp Loading… we call these CPU-bound we call these IO-bound CS449 (2184)

I'm turning this car around you've been playing for 3 hours… lemme just beat this boss okay??? if we give the CPU-bound processes priority… …then the IO-bound ones never get a turn. mommy has work to do, Billy if we give the IO-bound processes priority… cow!!!!!! …then the CPU-bound ones run really slowly. CS449 (2184)

Scheduling scheduling is how we make the processes take turns on the CPU this is an entire unit in CS1550 all the many ways of doing scheduling do the same basic thing: P1 P2 P5 P9 P1 P7 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 time we're slicing up time and giving each slice to a different process. scheduling answers the question: "which process goes next?" CS449 (2184)

Collaborative scheduling in this method, each process has to say "I'm done with my turn" before another process gets to run this is simple to implement and doesn't require any fancy OS or hardware features! …but we all know the problem with taking turns CS449 (2184)

What a hog while(true) {} the problem with collaborative scheduling is… if a process never gives up the CPU, nothing else can run. not even the kernel. so it's unfortunately really, really easy to make a collaboratively scheduled OS freeze… while(true) {} aaaand now you have to restart the computer. CS449 (2184)

Preemptive scheduling in this method, the OS can interrupt a process that's taking too long k, I'm done doo dee doo but.. but I wasn't… haha suckerrrr P1 P2 P5 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 P2, your turn ok P2 that's enough… P5, go! Kernel CS449 (2184)

Interrupted by an interrupt to make this work, we need special hardware in the CPU wheee!!! hey timer, wake me up in 100ms CPU P2 Kernel P2, gtfo RING RING!!!! the timer causes an interrupt – like a signal, but lower level only the kernel is allowed to respond to interrupts the quantum is how long a process has before it's preempted CS449 (2184)

The process lifecycle CS449 (2184)

The directed graph of life processes can be in one of many states Running normal exit scheduled fork()! preempted Created Ready (sleeping) Dead (or yielded) blocking syscall abnormal termination – crashed or killed OS detects syscall can complete Blocked CS449 (2184)

Scheduling points whenever a process gives up the CPU to the kernel, the kernel has a chance to schedule another process ("who's next?") there are a few ways for it to give up the CPU it could get preempted it used up its whole quantum and the OS interrupted it it could yield it voluntarily gives up control – it's playing nice!! it could use a blocking syscall such as reading data from a file it could exit either on purpose or by crashing. CS449 (2184)

and then it can schedule a process from the ready set Ready, set, blocked internally, the OS has these two (or more) sets of processes Blocked Ready P1 P4 P5 P9 P12 P7 yay!! when the kernel takes control, it can see if any of the blocked processes can be moved to the ready set and then it can schedule a process from the ready set CS449 (2184)

But context switches are haaaardddd processes are pretty big things with many parts Stack Heap Globals Code open files internal OS data structures the kernel uses to keep tabs on the process 34 35 process 14 has been running for 8 years and shows no signs of stopping. what the hell is it doing all this crap sure would be nice to get some of the benefits of processes without all the overhead… CS449 (2184)