Concurrency, Processes, and System calls Benefits and issues of concurrency The basic concept of process System calls.

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

More on Processes Chapter 3. Process image _the physical representation of a process in the OS _an address space consisting of code, data and stack segments.
Chapter 3 Process Description and Control
Process management Information maintained by OS for process management  process context  process control block OS virtualization of CPU for each process.
Interrupts Chapter 8 – pp Chapter 10 – pp Appendix A – pp 537 &
Concurrency: Threads, Address Spaces, and Processes Sarah Diesburg Operating Systems COP 4610.
Why Concurrency? Allows multiple applications to run at the same time  Analogy: juggling.
Architectural Support for OS March 29, 2000 Instructor: Gary Kimura Slides courtesy of Hank Levy.
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.
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.
Midterm Tuesday October 23 Covers Chapters 3 through 6 - Buses, Clocks, Timing, Edge Triggering, Level Triggering - Cache Memory Systems - Internal Memory.
1 Last Class: Introduction Operating system = interface between user & architecture Importance of OS OS history: Change is only constant User-level Applications.
Operating Systems CS208. What is Operating System? It is a program. It is the first piece of software to run after the system boots. It coordinates the.
1 Introduction Chapter What is an operating system 1.2 History of operating systems 1.3 The operating system zoo 1.4 Computer hardware review 1.5.
Process Concept An operating system executes a variety of programs
Mehmet Can Vuran, Instructor University of Nebraska-Lincoln Acknowledgement: Overheads adapted from those provided by the authors of the textbook.
Operating Systems (CSCI2413) Lecture 3 Processes phones off (please)
OS Spring’04 Introduction Operating Systems Spring 2004.
Using Two Queues. Using Multiple Queues Suspended Processes Processor is faster than I/O so all processes could be waiting for I/O Processor is faster.
Chapter 2 The OS, the Computer, and User Programs Copyright © 2008.
CSE 451: Operating Systems Autumn 2013 Module 6 Review of Processes, Kernel Threads, User-Level Threads Ed Lazowska 570 Allen.
System Calls 1.
Chapter 3 Process Description and Control Operating Systems: Internals and Design Principles, 6/E William Stallings Patricia Roy Manatee Community College,
Chapter 3 Process Description and Control Operating Systems: Internals and Design Principles, 6/E William Stallings Patricia Roy Manatee Community College,
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.
Implementing Processes and Process Management Brian Bershad.
Contact Information Office: 225 Neville Hall Office Hours: Monday and Wednesday 12:00-1:00 and by appointment.
Concurrency: Threads, Address Spaces, and Processes Andy Wang Operating Systems COP 4610 / CGS 5765.
Operating Systems Lecture 2 Processes and Threads Adapted from Operating Systems Lecture Notes, Copyright 1997 Martin C. Rinard. Zhiqing Liu School of.
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.
Operating Systems ECE344 Ashvin Goel ECE University of Toronto OS-Related Hardware.
Contact Information Office: 225 Neville Hall Office Hours: Monday and Wednesday 12:00-1:00 E-Main: Phone:
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.
Background: Operating Systems Brad Karp UCL Computer Science CS GZ03 / M th November, 2008.
Operating System Structure A key concept of operating systems is multiprogramming. –Goal of multiprogramming is to efficiently utilize all of the computing.
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.
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.
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.
1 Process Description and Control Chapter 3. 2 Requirements of an Operating System Interleave the execution of multiple processes to maximize processor.
Chapter 2 Process Management. 2 Objectives After finish this chapter, you will understand: the concept of a process. the process life cycle. process states.
1 Process Description and Control Chapter 3. 2 Process A program in execution An instance of a program running on a computer The entity that can be assigned.
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.
CSCI/CMPE 4334 Operating Systems Review: Exam 1 1.
Processes and Threads Chapter 3 and 4 Operating Systems: Internals and Design Principles, 6/E William Stallings Patricia Roy Manatee Community College,
Introduction to Operating Systems Concepts
Applied Operating System Concepts
Processes and threads.
Process Management Process Concept Why only the global variables?
Protection of System Resources
Lecture Topics: 11/1 Processes Process Management
CS 3305 System Calls Lecture 7.
Intro to Processes CSSE 332 Operating Systems
Concurrency: Threads, Address Spaces, and Processes
Chapter 15, Exploring the Digital Domain
Concurrency: Threads, Address Spaces, and Processes
CSE 451: Operating Systems Spring 2012 Module 6 Review of Processes, Kernel Threads, User-Level Threads Ed Lazowska 570 Allen.
PROCESS MANAGEMENT Information maintained by OS for process management
Lecture Topics: 11/1 General Operating System Concepts Processes
Architectural Support for OS
Threads and Concurrency
Threads Chapter 4.
Processes David Ferry CSCI 3500 – Operating Systems
Architectural Support for OS
Contact Information Office: 225 Neville Hall Office Hours: Monday and Wednesday 12:00-1:00 and by appointment. Phone:
Concurrency: Threads, Address Spaces, and Processes
Presentation transcript:

Concurrency, Processes, and System calls Benefits and issues of concurrency The basic concept of process System calls

Concurrency Allows multiple applications to run at the same time  Analogy: juggling

Benefits of Concurrency What are the limitations without concurrency?  Long response time  Resources under utilized Better resource utilization  Resources unused by one application can be used by the others Better average response time  No need to wait for other applications to complete

Benefits of Concurrency Keyboard CPU Disk Time Finishing time Keyboard CPU Disk

Issues related to concurrency It is easier to do one thing at a time. Problems with doing multiple things:  Applications need to be protected from one another  Additional coordination mechanisms among applications  Overhead to switch among applications Potential performance degradation when running too many applications

Process A process is a program in execution. A process is a basic scheduling unit in an OS: during the execution, each process has a virtual machine.  The execution of processes does not interference with one another. In a computer system, concurrency is realized by allowing multiple processes to co-exist at the same time. Most programs are single process programs and the OS hides the details about creation and termination of processes.

Process.vs. Program Program: a collection of instructions Process: a running instance of the program, with additional states and system resources  Example of additional states: process state (running, waiting, ready, etc)  Example of system resources: memory.

Process != Program Two processes can run the same program  The code segment of two processes are the same program  These two processes are totally independent of one another.

Program != Process A program can create multiple processes  Example: Internet Explorer

Process context It takes more than the “executable” to run a program. Process context, sometimes also called process image, includes everything needed for the OS to run the program correctly.  Program counter  Stack pointer, etc

System calls System calls are functions (enhanced instructions) implemented in OS that can be used by user processes. Handling system calls is like handling interrupts (sometimes call software interrupts).  Instead of a hardware event, the program issues an “interrupt” instruction.  All processors support such an instruction. The semantics of such instructions on different processors are similar (but have some slight differences). On x86, the instruction is int/iret. On MIPS, the instruction is syscall. On some other older machines, the instruction is called trap.

The semantic of the syscall instruction is similar to a routine call instruction. The difference is that (1) the syscall handler address is obtained from the system call/interrupt vector (table) maintained by the OS; and (2) the mode is changed to the system mode. Void open (char *file_name) { asm { load OpenSystemCallNum, r8 move filename, r9 syscall } Interrupt vector 0x0 0x1. OpenSystemCallNum “Open” handler

Question: The purpose of a system call is to invoke the system call handler routine. Why use the system call, instead of the simple routine call?  A system call changes the execution mode into system mode. Some instruction can only be executed under the system mode. Some services can only be provided correctly by the operating system due to the concurrency.

Question: Is syscall a system mode instruction or a user mode instruction? How about iret in x86?

Typical sequence of events when running the syscall instruction:  Current program counter (PC) and program status word (PSW) are saved.  The program mode is changed to the system mode.  Hardware load PC from the system call interrupt vector location  Execute the system call interrupt handler  Change mode back to user mode  Restore PC and PSW and continue user program.

System call interface  The system call interface is the description of the set of system calls supported by the OS.  The OS interface is pretty much defined by the system call interface.  Typical types of system calls Process control File management Device management Information management Communication management

Assuming that a system call and a routine performs the same task, which one will have better performance?  Homework!!