Silberschatz, Galvin and Gagne  2002 Modified for CSCI 399, Royden, 2005 3.1 Operating System Concepts Operating Systems Lecture 6 System Calls OS System.

Slides:



Advertisements
Similar presentations
Operating Systems Components of OS
Advertisements

Chap 2 System Structures.
Operating System Structure
Operating-System Structures
Silberschatz, Galvin and Gagne ©2009 Operating System Concepts – 8 th Edition Chapter 2: Operating-System Structures.
Chapter 3: Operating-System Structures
3.1 Silberschatz, Galvin and Gagne ©2003 Operating System Concepts with Java Chapter 3: Operating-System Structures System Components Operating System.
1/21/2008CSCI 315 Operating Systems Design1 Operating System Structures Notice: The slides for this lecture have been largely based on those accompanying.
Chapter 2: Operating-System Structures
Silberschatz, Galvin and Gagne  Operating System Concepts Chapter 3: Operating-System Structures System Components Operating System Services.
1/28/2004CSCI 315 Operating Systems Design1 Operating System Structures & Processes Notice: The slides for this lecture have been largely based on those.
1/26/2004CSCI 315 Operating Systems Design1 Operating System Structures Notice: The slides for this lecture have been largely based on those accompanying.
Common System Components
1/23/2008CSCI 315 Operating Systems Design1 Processes Notice: The slides for this lecture have been largely based on those accompanying the textbook Operating.
Os31 Chapter 3 Operating-System Structures. os32 Outlines System Components Operating System Services System Calls System Programs System Structure Virtual.
Silberschatz, Galvin and Gagne  Operating System Concepts Common OS Components Process Management Memory Management File Management I/O System.
Silberschatz, Galvin and Gagne ©2013 Operating System Concepts – 9 th Edition Chapter 2: Operating-System Structures.
Silberschatz, Galvin and Gagne ©2009 Operating System Concepts – 8 th Edition Chapter 2: Operating-System Structures Modified from the text book.
Chapter 3: Operating-System Structures System Components Operating System Services System Calls System Programs System Structure Virtual Machines System.
Abhinav Kamra Computer Science, Columbia University 3.1 Operating System Concepts Silberschatz, Galvin and Gagne  2002 Chapter 3: Operating-System Structures.
Silberschatz, Galvin and Gagne  2002 Modified for CSCI 346, Royden, Operating System Concepts Operating Systems Lecture 4 System Calls OS System.
Silberschatz, Galvin and Gagne  Operating System Concepts Chapter 3: Operating-System Structures System Components Operating System Services.
Silberschatz, Galvin and Gagne  Applied Operating System Concepts Chapter 3: Operating-System Structures System Components OS Services System.
2.1 Silberschatz, Galvin and Gagne ©2009Operating System Concepts with Java – 8 th Edition Chapter 2: Operating-System Structures.
Silberschatz, Galvin and Gagne ©2013 Operating System Concepts – 9 th Edition Chapter 2: Operating-System Structures.
Chapter 2: Operating-System Structures. 2.2 Silberschatz, Galvin and Gagne ©2005 Operating System Concepts – 7 th Edition, Jan 14, 2005 Operating System.
Chapter 2: Operating-System Structures. 2.2 Silberschatz, Galvin and Gagne ©2005 Operating System Concepts Chapter 2: Operating-System Structures Operating.
2.1 Silberschatz, Galvin and Gagne ©2005 Operating System Concepts Chapter 2: Operating-System Structures Overview of topics covered Operating System Services.
Silberschatz, Galvin and Gagne  Operating System Concepts Chapter 3: Operating-System Structures System Components Operating System Services.
Lecture 3 Process Concepts. What is a Process? A process is the dynamic execution context of an executing program. Several processes may run concurrently,
Silberschatz, Galvin and Gagne  2002 Modified for CSCI 399, Royden, Operating System Concepts Operating Systems Lecture 7 OS System Structure.
Silberschatz, Galvin and Gagne ©2009 Operating System Concepts – 8 th Edition, Chapter 2: Operating-System Structures.
Silberschatz and Galvin  Operating System Concepts Module 3: Operating-System Structures System Components Operating System Services System Calls.
Silberschatz, Galvin and Gagne ©2013 Operating System Concepts – 9 th Edition Chapter 2: Operating-System Structures.
CE Operating Systems Lecture 3 Overview of OS functions and structure.
3.1 Silberschatz, Galvin and Gagne ©2003 Operating System Concepts with Java Chapter 3: Operating-System Structures System Components Operating System.
Silberschatz, Galvin and Gagne  Operating System Concepts Chapter 3: Operating-System Structures System Components Operating System Services.
Silberschatz, Galvin, and Gagne  Applied Operating System Concepts Module 3: Operating-System Structures System Components Operating System Services.
3.1 Operating System Chapter 3: Operating-System Structures System Components Operating System Services System Calls System Programs System Structure Virtual.
Processes Introduction to Operating Systems: Module 3.
Silberschatz, Galvin and Gagne  Operating System Concepts Chapter 3: Operating-System Structures System Components Operating System Services.
Operating Systems Structure what is the organizational principle?
1 CSE Department MAITSandeep Tayal Operating-System Structures System Components Operating System Services System Calls System Programs System Structure.
Silberschatz, Galvin and Gagne  Operating System Concepts UNIT II Operating System Services.
1 CS.217 Operating System By Ajarn..Sutapart Sappajak,METC,MSIT Chapter 3 Operating-System Structures Slide 1 Chapter 3 Operating-System Structures.
A. Frank - P. Weisberg Operating Systems Structure of Operating Systems.
1.1 Silberschatz, Galvin and Gagne ©2009 Operating System Concepts – 8 th Edition Lecture 2: OS Structures (Chapter 2.7)
Silberschatz, Galvin and Gagne  2002 Modified for CSCI 399, Royden, Operating System Concepts Operating Systems Lecture 4 Computer Systems Review.
2.1 Silberschatz, Galvin and Gagne ©2009 Operating System Concepts – 8 th Edition System Programs (p73) System programs provide a convenient environment.
Silberschatz, Galvin, and Gagne  Applied Operating System Concepts Module 3: Operating-System Structures System Components Operating System Services.
1 Chapter 2: Operating-System Structures Services Interface provided to users & programmers –System calls (programmer access) –User level access to system.
Operating System Structure Lecture: - Operating System Concepts Lecturer: - Pooja Sharma Computer Science Department, Punjabi University, Patiala.
Silberschatz, Galvin and Gagne  Operating System Concepts Chapter 3: Operating-System Structures System Components Operating System Services.
Silberschatz, Galvin and Gagne  2002 Modified for CSCI 399, Royden, Operating System Concepts Operating Systems Lecture 8 Processes II Read Ch.
Module 3: Operating-System Structures System Components Operating System Services System Calls System Programs System Structure Virtual Machines System.
Introduction to Operating Systems Concepts
Computer System Structures
Module 3: Operating-System Structures
Operating System Structures
Chapter 2: Operating-System Structures
Lecture 4: Operating System Structures
Chapter 2: System Structures
Chapter 2: System Structures
Chapter 3: Operating-System Structures
Chapter 1 Introduction to Operating System Part 5
Chapter 2: Operating-System Structures
Operating Systems Lecture 3.
Outline Chapter 2 (cont) OS Design OS structure
System calls….. C-program->POSIX call
Chapter 2: Operating-System Structures
Presentation transcript:

Silberschatz, Galvin and Gagne  2002 Modified for CSCI 399, Royden, Operating System Concepts Operating Systems Lecture 6 System Calls OS System Structure

Silberschatz, Galvin and Gagne  2002 Modified for CSCI 399, Royden, Operating System Concepts System Calls System calls provide the interface between a running program and the operating system.  Generally available as assembly-language instructions.  Languages defined to replace assembly language for systems programming allow system calls to be made directly (e.g., C, C++)

Silberschatz, Galvin and Gagne  2002 Modified for CSCI 399, Royden, Operating System Concepts System Calls are Used Frequently A single program may make numerous system calls. For example, a program to read from one file and write to another would need system calls for the following:  Prompt the user to enter file names  Read in filenames  Open input file  Read from input file  Open/create output file  Write output to file  Close input and output files The system must be able to signal and handle errors that occur.

Silberschatz, Galvin and Gagne  2002 Modified for CSCI 399, Royden, Operating System Concepts Passing Parameters Three general methods are used to pass parameters between a running program and the operating system.  Pass parameters in registers.  Store the parameters in a table in memory, and the table address is passed as a parameter in a register.  Push (store) the parameters onto the stack by the program, and pop off the stack by operating system.

Silberschatz, Galvin and Gagne  2002 Modified for CSCI 399, Royden, Operating System Concepts Passing of Parameters As A Table

Silberschatz, Galvin and Gagne  2002 Modified for CSCI 399, Royden, Operating System Concepts Types of System Calls Process control  create (fork), execute (exec), wait, end (exit), abort (kill), etc. File management  creat, delete, open, close, read, write, cp, rm, mkdir, rmdir, ls, cat, more, grep, etc. get/set file attributes Device management  read, write, attach (mount), detach (unmount), get/set device attributes Information maintenance  get/set time or date, get/set file attributes (chmod, chown, chgrp), get/set process/device attributes (du, ps, etc) Communications  send, receive, connect, accept, get/set status information, gethostid/sethostid, gethostbyname, etc.

Silberschatz, Galvin and Gagne  2002 Modified for CSCI 399, Royden, Operating System Concepts Process Control A process executing one program may want to load and execute another program (e.g. the shell loads and executes programs). The following are important considerations: Where does control return when the new process is finished?  If return control to existing program, must save memory image of existing program before loading new process.  If both programs are to run concurrently, the new process is added to the multiprogramming set of processes. Controlling execution of the process:  get/set process attributes, terminate process Waiting for the process to finish  wait event, signal event Terminating the process  Normal (exit) or abnormal (abort) termination. There are multiple ways of implementing process control.

Silberschatz, Galvin and Gagne  2002 Modified for CSCI 399, Royden, Operating System Concepts MS-DOS Execution At System Start-up Running a Program MS-DOS runs the command interpreter on startup. It loads a new program into memory, writing over part of the interpreter. When the program terminates, the part of the interpreter not overwritten begins execution. It loads the rest of the interpreter from disk.

Silberschatz, Galvin and Gagne  2002 Modified for CSCI 399, Royden, Operating System Concepts UNIX Running Multiple Programs UNIX runs the shell on startup. To start a new process, it uses the fork command to create the process and exec to execute it. If the process is in the foreground, the shell waits for the process to finish. If the process is in the background, the user can continue to issue commands while the process is running. When the process is finished, it executes an exit system call.

Silberschatz, Galvin and Gagne  2002 Modified for CSCI 399, Royden, Operating System Concepts Message Passing Processes use message passing to send messages to one another. First, the connection must be opened.  The name of the communicator must be known (hos tname or host id, process name or process id). Use get process id or get host id.  open connection, close connection  recipient uses accept connection  The initiator is the client. The recipient of the request is the server. Exchange of information made with write message system calls.

Silberschatz, Galvin and Gagne  2002 Modified for CSCI 399, Royden, Operating System Concepts Shared Memory In memory sharing, processes communicate by writing and reading to the same memory addresses. Processes use map memory system calls to access memory owned by other processes. Both processes must agree to remove O.S. memory restriction so that they can access the same region of memory. The processes are responsible for the form and location of the data. The processes are responsible for making sure that they are not writing to the same memory area simultaneously.

Silberschatz, Galvin and Gagne  2002 Modified for CSCI 399, Royden, Operating System Concepts Communication Models Msg Passing Shared Memory Communication may take place using either message passing or shared memory.

Silberschatz, Galvin and Gagne  2002 Modified for CSCI 399, Royden, Operating System Concepts System Programs System programs provide a convenient environment for program development and execution. The can be divided into:  File manipulation  Status information  File modification  Programming language support  Program loading and execution  Communications  Application programs Most users’ view of the operation system is defined by system programs, not the actual system calls.

Silberschatz, Galvin and Gagne  2002 Modified for CSCI 399, Royden, Operating System Concepts MS-DOS System Structure MS-DOS – written to provide the most functionality in the least space  not divided into modules  Although MS-DOS has some structure, its interfaces and levels of functionality are not well separated

Silberschatz, Galvin and Gagne  2002 Modified for CSCI 399, Royden, Operating System Concepts MS-DOS Layer Structure

Silberschatz, Galvin and Gagne  2002 Modified for CSCI 399, Royden, Operating System Concepts UNIX System Structure UNIX – limited by hardware functionality, the original UNIX operating system had limited structuring. The UNIX OS consists of two separable parts.  Systems programs  The kernel  Consists of everything below the system-call interface and above the physical hardware  Provides the file system, CPU scheduling, memory management, and other operating-system functions; a large number of functions for one level.

Silberschatz, Galvin and Gagne  2002 Modified for CSCI 399, Royden, Operating System Concepts UNIX System Structure

Silberschatz, Galvin and Gagne  2002 Modified for CSCI 399, Royden, Operating System Concepts Layered Approach 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 hardware; the highest (layer N) is the user interface. With modularity, layers are selected such that each uses functions (operations) and services of only lower-level layers. Advantage: Modularity makes it easy to modify and extend. Disadvantage: Some functions may depend on one another, making a strict hierarchy difficult to implement.

Silberschatz, Galvin and Gagne  2002 Modified for CSCI 399, Royden, Operating System Concepts An Operating System Layer

Silberschatz, Galvin and Gagne  2002 Modified for CSCI 399, Royden, Operating System Concepts OS/2 Layer Structure

Silberschatz, Galvin and Gagne  2002 Modified for CSCI 399, Royden, Operating System Concepts Microkernel System Structure Moves as much from the kernel into “user” space. Communication takes place between user modules using message passing. Benefits: - easier to extend a microkernel - easier to port the operating system to new architectures - more reliable (less code is running in kernel mode) - more secure Example: Mac OS X is based on the Mach micro kernel.