Chap 4, 5: Process. Dongkun Shin, SKKU

Similar documents
Chapter 3: Processes. Operating System Concepts 9 th Edit9on

Chapter 3: Processes

Chapter 3: Processes

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

Chapter 3: Process Concept

Chapter 3: Process Concept

Chapter 3: Process Concept

Agenda Process Concept Process Scheduling Operations on Processes Interprocess Communication 3.2

Operating System Design

TDIU25: Operating Systems II. Processes, Threads and Scheduling

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

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

PROCESS CONTROL BLOCK TWO-STATE MODEL (CONT D)

CPSC 341 OS & Networks. Processes. Dr. Yingwu Zhu

Chapter 3: Processes. Operating System Concepts 9 th Edition

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

Processes. CS 475, Spring 2018 Concurrent & Distributed Systems

Operating Systems. Lecture 05

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

Process Description and Control. Chapter 3

CS370 Operating Systems

Chapter 3 Processes. Process Concept. Process Concept. Process Concept (Cont.) Process Concept (Cont.) Process Concept (Cont.)

Reading Assignment 4. n Chapter 4 Threads, due 2/7. 1/31/13 CSE325 - Processes 1

Processes. Process Management Chapter 3. When does a process gets created? When does a process gets terminated?

PROCESS MANAGEMENT. Operating Systems 2015 Spring by Euiseong Seo

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

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

CSCE 313 Introduction to Computer Systems. Instructor: Dezhen Song

CSCE 313: Intro to Computer Systems

Computer Systems II. First Two Major Computer System Evolution Steps

CHAPTER 3 - PROCESS CONCEPT

Chapter 3: Processes. Operating System Concepts 9 th Edition

What Is A Process? Process States. Process Concept. Process Control Block (PCB) Process State Transition Diagram 9/6/2013. Process Fundamentals

Announcements Processes: Part II. Operating Systems. Autumn CS4023

Process Management Rab Nawaz Jadoon

Processes. CS3026 Operating Systems Lecture 05

Chapter 3: Process Concept

Operating Systems. Figure: Process States. 1 P a g e

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

Killing Zombies, Working, Sleeping, and Spawning Children

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

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

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

Operating Systems Process description and control

Lecture Topics. Announcements. Today: Threads (Stallings, chapter , 4.6) Next: Concurrency (Stallings, chapter , 5.

Processes COMPSCI 386

Major Requirements of an OS

CSC 539: Operating Systems Structure and Design. Spring 2006

OPERATING SYSTEMS: Lesson 4: Process Scheduling

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

Notice: This set of slides is based on the notes by Professor Perrone of Bucknell and the textbook authors Silberschatz, Galvin, and Gagne

Processes. CS439: Principles of Computer Systems January 30, 2019

Process Description and Control. Chapter 3

Process Concepts 8/21/2014. CS341: Operating System. Scheduling: Theoretical Analysis

Processes. Dr. Yingwu Zhu

REVIEW OF COMMONLY USED DATA STRUCTURES IN OS

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

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

Mon Sep 17, 2007 Lecture 3: Process Management

CHAPTER 2: PROCESS MANAGEMENT

Processes. CS439: Principles of Computer Systems January 24, 2018

Unix Processes. What is a Process?

Process Description and Control

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

Process Description and Control. Major Requirements of an Operating System

Major Requirements of an Operating System Process Description and Control

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

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

Process Description and Control. Chapter 3

Course: Operating Systems Instructor: M Umair. M Umair

Processes and Threads

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

IT 540 Operating Systems ECE519 Advanced Operating Systems

Processes. Process Concept

Operating System Structure

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

CS Lecture 2! Processes! George Mason University! Fall 2010!

Introduction to Operating Systems Prof. Chester Rebeiro Department of Computer Science and Engineering Indian Institute of Technology, Madras

Processes. Processes and Process Management. What is a Process? What is a Process? What is a Process? Program Process

CS24: INTRODUCTION TO COMPUTING SYSTEMS. Spring 2018 Lecture 20

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

PROCESSES. Jo, Heeseung

Processes. Jo, Heeseung

3.1 Introduction. Computers perform operations concurrently

Process Description and Control

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

Processes and Non-Preemptive Scheduling. Otto J. Anshus

Process Description and Control

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

Processes & Threads. Today. Next Time. ! Process concept! Process model! Implementing processes! Multiprocessing once again. ! More of the same J

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

CS370 Operating Systems Midterm Review

2/14/2012. Using a layered approach, the operating system is divided into N levels or layers. Also view as a stack of services

What is a Process? Processes and Process Management Details for running a program

Process Concept. Minsoo Ryu. Real-Time Computing and Communications Lab. Hanyang University.

Processes. Jin-Soo Kim Computer Systems Laboratory Sungkyunkwan University

Process. Operating Systems (Fall/Winter 2018) Yajin Zhou ( Zhejiang University

CS 471 Operating Systems. Yue Cheng. George Mason University Fall 2017

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

Operating Systems CMPSC 473. Process Management January 29, Lecture 4 Instructor: Trent Jaeger

Transcription:

Chap 4, 5: Process 1

Process Concept Job A bundle of program and data to be executed An entity before submission for execution Process (= running program) An entity that is registered to kernel for execution Kernel manages the processes to improve overall system performance 2

Process Concept A process is A program in execution An entity that is registered and being managed by kernel An entity that is admitted to request and use system resources An entity that is allocated the PCB An active entity Request/allocate/release system resources during execution PCB (Process Control Block) Keeps several information about each process that is registered to the kernel Maintained in kernel space 3

Machine State of Process A process includes Memory Program code text Global data data Temporary data stack Local variables, function parameters, return addresses Heap Memory area that is dynamically allocated during execution Registers Values of the processor registers Include program counter, stack pointer, frame pointer I/O information a list of the files the process currently has open process memory 4

Process API Create Some method to create new processes. OS is invoked to create a new process to run the program you have indicated. Destroy an interface to destroy processes forcefully. Wait Wait for a process to stop running Miscellaneous Control suspend a process (stop it from running for a while) and then resume it (continue it running). Status get some status information about a process as well, such as how long it has run for, or what state it is in. 5

Process States Running a process is running on a processor, executing instructions. Ready a process is ready to run but for some reason the OS has chosen not to run it at this given moment. Blocked a process has performed some kind of operation that makes it not ready to run until some other event takes place. A common example: when a process initiates an I/O request to a disk, it becomes blocked and thus some other process can use the processor. 6

PCB PCB 7

PCB Information in PCB (task control block) PID (Process Identification Number) Process state: running, waiting, etc Program counter: location of instruction to next execute CPU registers: contents of all process-centric registers Scheduling information Process priority, scheduling parameters, etc. Memory management information Base/limit registers, page tables, segment tables, etc. I/O status information List of I/O devices allocated, list of open files, etc. Accounting information CPU used, clock time elapsed since start, time limits Context save area Space for saving register context of the process 8

PCB In Unix Process table slot U-area In Linux Process descriptor (task_struct) Notes PCB information is different for each OS PCB access speed is important for overall system performance 9

Process Creation 1. Programs initially reside on disk in some kind of executable format 2. load a program s code and any static data into memory, into the address space of the process. Eager or lazy loading (paging and swapping) 3. Allocate run-time stack & initialize it with arguments (argc, argv) 4. Allocate heap 5. Do other initialization tasks related to I/O setup 6. jump to the main() routine, transfers control of the CPU to the newly-created process 10

Process Creation Parent process create children processes, which, in turn create other processes, forming a tree of processes Generally, process identified and managed via a process identifier (pid) Resource sharing options Parent and children share all resources Children share subset of parent s resources Parent and child share no resources Execution options Parent and children execute concurrently Parent waits until children terminate 11

Process Tree in Linux init pid = 1 login pid = 8415 kthreadd pid = 2 sshd pid = 3028 bash pid = 8416 khelper pid = 6 pdflush pid = 200 sshd pid = 3610 ps pid = 9298 emacs pid = 9204 tcsch pid = 4005 12

PS command in Linux 13

Process Creation API fork() Address space Child duplicate of parent Child has a program loaded into it UNIX examples fork() system call creates new process exec() system call used after a fork() to replace the process memory space with a new program Return value of fork() - Parent: child PID - Child: 0 14

Process Creation API wait() 15

Process Creation API exec() The separation of fork() and exec() is essential in building a UNIX shell 16

Process States 17

Process States Created state User s job/command request is registered to the kernel PCB allocated New process is being created Transient state Kernel Check available memory space Transit the process to ready or suspended ready state Process creation in Unix system By fork() system call Process creation By system call Parent process, child process Tree-structured process hierarchy 18

Process States Ready state Allocated all resources necessary except processor Waiting processor allocation Can execute immediately when the processor is allocated Dispatch, schedule Transition from ready state to running state 19

Process States Running state Owns processor now (executing its program on the processor) Owns all resources necessary Preemption Transition from running state to ready state Due to the expiration of time quantum (time slice) or appearance of higher priority process Block/sleep Transition from running state to asleep state Due to the resource request, waiting for I/O or system call completion, during execution (running) 20

Process States Blocked/asleep state Requested some resources other than processor or memory and waiting for them Resource request through system call System call, SVC (SuperVisor Call) Kernel provides application processes with system call interface so that they can request resources Wakeup Transition from asleep state to ready state Due to allocation of resources or occurrence of events 21

Process States Terminated/zombie state Completing process execution Releasing all resources allocated Only having some information in PCB (in kernel space, memory) Process termination in Unix system By exit() system call 22

Process Termination Process executes last statement and then asks the operating system to delete it using the exit() system call. Returns status data from child to parent (via wait()) Process resources are deallocated by operating system Parent may terminate the execution of children processes using the abort() system call. Some reasons for doing so: Child has exceeded allocated resources Task assigned to child is no longer required The parent is exiting and the operating systems does not allow a child to continue if its parent terminates A parent may kill its children if the task assigned to them is no longer needed 23

Process Termination Some operating systems do not allow child to exists if its parent has terminated. If a process terminates, then all its children must also be terminated. cascading termination. All children, grandchildren, etc. are terminated. The termination is initiated by the operating system. The parent process may wait for termination of a child process by using the wait()system call. The call returns status information and the pid of the terminated process pid = wait(&status); If no parent waiting (did not invoke wait()) process is a zombie If parent terminated without invoking wait, process is an orphan 24

Zombie & Orphan 25

Process States in Linux 26

Scheduling Queues Ready queue Processes in ready state Requesting processor, all other resources allocated Ready queue (ready list) Process scheduling Selecting a process from the ready list and dispatch it when the processor is available I/O queue Processes in asleep state Each requesting different resources Block list (block queue, I/O queue) Separate list for each resource 27

Scheduling Queues 28

Scheduling Queues Device queue Used when processes requesting I/O resources wait for their availability A queue for each device 29