Processes & Threads. Recap of the Last Class. Layered Structure. Virtual Machines. CS 256/456 Dept. of Computer Science, University of Rochester

Similar documents
Processes & Threads. Recap of the Last Class. Microkernel System Architecture. Layered Structure

Process and Its Image An operating system executes a variety of programs: A program that browses the Web A program that serves Web requests

Process. Heechul Yun. Disclaimer: some slides are adopted from the book authors slides with permission

More on Synchronization and Deadlock

Operating Systems 9/6/ SIGINT Terminate Interrupt from keyboard (ctl-c) 9 SIGKILL Terminate Kill program (cannot override or ignore)

Process. Heechul Yun. Disclaimer: some slides are adopted from the book authors slides with permission 1

Roadmap. Tevfik Ko!ar. CSC Operating Systems Spring Lecture - III Processes. Louisiana State University. Virtual Machines Processes

Processes and More. CSCI 315 Operating Systems Design Department of Computer Science

Unix API Books. Linux Kernel Books. Assignments and Exams. Grading for CSC 256. Operating Systems 8/31/2018. CSC 256/456 Fall

Processes. Process Concept

Processes. Dr. Yingwu Zhu

Deadlock. A Bit More on Synchronization. The Deadlock Problem. Deadlock Characterization. Operating Systems 2/7/2005. CSC 256/456 - Spring

Ricardo Rocha. Department of Computer Science Faculty of Sciences University of Porto

CS 450 Operating System Week 4 Lecture Notes

Chapter 4: Threads. Operating System Concepts. Silberschatz, Galvin and Gagne

Chapter 3: Processes. Operating System Concepts 8 th Edition,

PROCESSES. Jo, Heeseung

Processes. Jo, Heeseung

Chapter 3: Processes

Processes. CS 475, Spring 2018 Concurrent & Distributed Systems

Chapter 3: Process-Concept. Operating System Concepts 8 th Edition,

2. PROCESS. Operating System Concepts with Java 8th Edition Silberschatz, Galvin and Gagn

Part V. Process Management. Sadeghi, Cubaleska RUB Course Operating System Security Memory Management and Protection

csci3411: Operating Systems

Chapter 3: Processes. Operating System Concepts 9 th Edit9on

Announcements Processes: Part II. Operating Systems. Autumn CS4023

Processes. CS3026 Operating Systems Lecture 05

Basic Memory Management. Basic Memory Management. Address Binding. Running a user program. Operating Systems 10/14/2018 CSC 256/456 1

Process a program in execution; process execution must progress in sequential fashion. Operating Systems

Chapter 5: Processes & Process Concept. Objectives. Process Concept Process Scheduling Operations on Processes. Communication in Client-Server Systems

Chapter 4: Processes. Process Concept

Chapter 4: Processes

PROCESS MANAGEMENT. Operating Systems 2015 Spring by Euiseong Seo

Basic Memory Management

Introduction to OS Processes in Unix, Linux, and Windows MOS 2.1 Mahmoud El-Gayyar

Chap 4, 5: Process. Dongkun Shin, SKKU

Operating System Structure

Chapter 3: Processes. Chapter 3: Processes. Process in Memory. Process Concept. Process State. Diagram of Process State

CS 475. Process = Address space + one thread of control Concurrent program = multiple threads of control

High-level Synchronization

Roadmap. Tevfik Ko!ar. CSC Operating Systems Fall Lecture - III Processes. Louisiana State University. Processes. September 1 st, 2009

Frequently asked questions from the previous class survey

OS lpr. www. nfsd gcc emacs ls 1/27/09. Process Management. CS 537 Lecture 3: Processes. Example OS in operation. Why Processes? Simplicity + Speed

Fall 2017 :: CSE 306. Process Abstraction. Nima Honarmand

I/O Device Controllers. I/O Systems. I/O Ports & Memory-Mapped I/O. Direct Memory Access (DMA) Operating Systems 10/20/2010. CSC 256/456 Fall

Ricardo Rocha. Department of Computer Science Faculty of Sciences University of Porto

Processes and Threads

www nfsd emacs lpr Process Management CS 537 Lecture 4: Processes Example OS in operation Why Processes? Simplicity + Speed

CSE 4/521 Introduction to Operating Systems

Dept. Of Computer Science, Colorado State University

Lecture 4: Process Management

Chapter 3: Processes. Operating System Concepts Essentials 2 nd Edition

Frequently asked questions from the previous class survey

Distributed File Systems Issues. NFS (Network File System) AFS: Namespace. The Andrew File System (AFS) Operating Systems 11/19/2012 CSC 256/456 1

Chapter 3: Processes. Operating System Concepts 8th Edition,

Chapter 3: Processes

W4118 Operating Systems. Junfeng Yang

CSE 153 Design of Operating Systems Fall 2018

Killing Zombies, Working, Sleeping, and Spawning Children

OS lpr. www. nfsd gcc emacs ls 9/18/11. Process Management. CS 537 Lecture 4: Processes. The Process. Why Processes? Simplicity + Speed

Processes. Sanzheng Qiao. December, Department of Computing and Software

COMP 3430 Robert Guderian

Process Concepts. CSC400 - Operating Systems. 3. Process Concepts. J. Sumey

1 PROCESSES PROCESS CONCEPT The Process Process State Process Control Block 5

Chapter 4: Multithreaded Programming

Chapter 3: Process Concept

CS370: System Architecture & Software [Fall 2014] Dept. Of Computer Science, Colorado State University

CS 326: Operating Systems. Process Execution. Lecture 5

Operating Systems CMPSCI 377 Spring Mark Corner University of Massachusetts Amherst

CSC 539: Operating Systems Structure and Design. Spring 2006

Announcement. Exercise #2 will be out today. Due date is next Monday

Processes and Threads

Getting to know you. Anatomy of a Process. Processes. Of Programs and Processes

Process. Program Vs. process. During execution, the process may be in one of the following states

1/13/2019 Operating Systems. file:///volumes/users/rasit/desktop/comp3430/coursematerial/slides/03_processes/index.html?

Chapter 3: Processes. Operating System Concepts Essentials 8 th Edition

Processes and Threads

! The Process Control Block (PCB) " is included in the context,

Chapter 4: Threads. Overview Multithreading Models Threading Issues Pthreads Windows XP Threads Linux Threads Java Threads. Operating System Concepts

Chapter 3: Processes. Operating System Concepts 8 th Edition,

Chapter 4: Threads. Operating System Concepts 9 th Edit9on

Threads. CS-3013 Operating Systems Hugh C. Lauer. CS-3013, C-Term 2012 Threads 1

Operating Systems. II. Processes

csci3411: Operating Systems

Operating Systems & Concurrency: Process Concepts

Chapter 4: Threads. Chapter 4: Threads

Processes and Threads. Processes and Threads. Processes (2) Processes (1)

Last time: introduction. Networks and Operating Systems ( ) Chapter 2: Processes. This time. General OS structure. The kernel is a program!

Computer Science 322 Operating Systems Mount Holyoke College Spring Topic Notes: Processes and Threads

I/O Systems and Storage Devices

Operating System Design

Last Class. System Calls, Kernel Mode, and Process Implementation. Processes. Today. Operating Systems 9/11/2018 CSC 256/456 1

Threads. Computer Systems. 5/12/2009 cse threads Perkins, DW Johnson and University of Washington 1

Chapter 3: Processes. Operating System Concepts 8th Edition, modified by Stewart Weiss

The Big Picture So Far. Today: Process Management

Diagram of Process State Process Control Block (PCB)

Agenda Process Concept Process Scheduling Operations on Processes Interprocess Communication 3.2

Processes and Non-Preemptive Scheduling. Otto J. Anshus

3. Process Management in xv6

Exercise (could be a quiz) Solution. Concurrent Programming. Roadmap. Tevfik Koşar. CSE 421/521 - Operating Systems Fall Lecture - IV Threads

Transcription:

Recap of the Last Class Processes & Threads CS 256/456 Dept. of Computer Science, University of Rochester Hardware protection kernel and mode System components process management, memory management, I/O system, file and storage, networking, Operating system architectures monolithic architecture, microkernel 1/25/2006 CSC 256/456 - Spring 2006 1 1/25/2006 CSC 256/456 - Spring 2006 2 Layered Structure Layered structure The operating system is divided into a number of layers (levels), each built on top of lower layers. The bottom layer (layer 0), is the. The highest (layer N) is the interface. Decreased privileges for higher layers. Benefits: more reliable more secure more flexibility Disadvantage: Weak integration results in performance penalty (similar to the microkernel structure). Virtual Machines A virtual machine Virtualization: It is a piece of software that provides an interface identical to the underlying bare. Multiplexing: It provides several copies of this interface on top of a single piece of. Resource management: The resources of the physical computer are shared to create the virtual machines. e.g., CPU scheduling can create the appearance that each piece of upper-layer software has its own processor. It is not an operating system in the strict sense It is a resource manager, but not an extended machine 1/25/2006 CSC 256/456 - Spring 2006 3 1/25/2006 CSC 256/456 - Spring 2006 4

VM Models Usage of Virtual Machines Running several different es on a single machine VM monitor on native native VM monitor Education Research and development of operating systems and computer architecture Enhanced reliability and security Allow general management of machines at software level Non-VM Native VM Hosted VM 1/25/2006 CSC 256/456 - Spring 2006 5 1/25/2006 CSC 256/456 - Spring 2006 6 Outline Process Process concept A process s image in a computer Operations on processes Thread Thread concept Multithreading models Types of threads Process and Its Image An operating system executes a variety of : A program that browses the Web A program that serves Web requests Process a program in execution. A process s state/image in a computer includes: User-mode address space Kernel data structure Registers (including program counter and stack pointer) Address space and memory protection Physical memory is divided into memory and kernel memory Kernel memory can only be accessed when in the kernel mode Each process has its own exclusive address space in the mode memory space (sort-of) 1/25/2006 CSC 256/456 - Spring 2006 7 1/25/2006 CSC 256/456 - Spring 2006 8

User-mode Address Space Process Control Block (PCB) User-mode address space for a process: Text: program code, instructions Data: initialized global and static variables (those data whose size is known before the execution) BSS (block started by symbol): uninitialized global and static variables Heap: dynamic memory (those being malloc-ed) Stack: local variables and other stuff for function invocations 0xffffffff 0 Stack Heap BSS Data Text data structure (in kernel memory) maintaining information associated with each process. Process state Program counter CPU registers CPU scheduling information Memory-management information Accounting information Information about open files maybe kernel stack? 1/25/2006 CSC 256/456 - Spring 2006 9 1/25/2006 CSC 256/456 - Spring 2006 10 Process State As a process executes, it changes state new: The process is being created. ready: The process is waiting to be assigned to a process. running: Instructions are being executed. waiting: The process is waiting for some event to occur. terminated: The process has finished execution. Process Creation When a process (parent) creates a new process (child) Execution sequence? Address space sharing? Open files inheritance? UNIX examples fork system call creates new process with a duplicated copy of everything. exec system call used after a fork to replace the process memory space with a new program. child and parent compete CPU like two normal processes. Copy-on-write 1/25/2006 CSC 256/456 - Spring 2006 11 1/25/2006 CSC 256/456 - Spring 2006 12

Process Tree on a Linux System Parent process creates children processes, which, in turn create other processes, forming a tree of processes. daemon x daemon y daemon z init (pid=1) KDE-init 1 sshd 2 CPU Switch From Process to Process When can the switch the CPU from one process to another? shell 1a shell 1b shell 2c Which one to switch to? - scheduling 1/25/2006 CSC 256/456 - Spring 2006 13 1/25/2006 CSC 256/456 - Spring 2006 14 Queues for PCBs Ready queue set of all processes ready for execution. Device queues set of processes waiting for an I/O device. Process migration between the various queues. Process Termination Process executes last statement and gives the control to the (exit). Notify parent if it is wait-ing. Deallocate process resources. The may forcefully terminate a process. Software exceptions Receiving certain signals 1/25/2006 CSC 256/456 - Spring 2006 15 1/25/2006 CSC 256/456 - Spring 2006 16

Processes and Threads Thread a program in execution; without a dedicated address space. memory protection is only applied to processes. Why Use Threads? Multithreading is used for parallelism/concurrency. But why not multiple processes? Memory sharing. Efficient synchronization between threads Less context switch overhead 1/25/2006 CSC 256/456 - Spring 2006 17 1/25/2006 CSC 256/456 - Spring 2006 18 User/Kernel Threads What is really happening when the execution of one thread switches to another? save the registers (including the SP) of the old thread; restore the registers of the new thread; set the new PC appropriately for the new thread; Does this need help from the kernel? Can you do it in C/Java? Does process switching need help from the kernel? Disclaimer Parts of the lecture slides contain original work of Abraham Silberschatz, Peter B. Galvin, Greg Gagne, Andrew S. Tanenbaum, and Gary Nutt. The slides are intended for the sole purpose of instruction of operating systems at the University of Rochester. All copyrighted materials belong to their original owner(s). User threads Thread data structure is in -mode memory scheduling/switching done at mode Kernel threads Thread data structure is in kernel memory scheduling/switching done by the kernel 1/25/2006 CSC 256/456 - Spring 2006 19 1/25/2006 CSC 256/456 - Spring 2006 20