ESE 333 Real-Time Operating Systems 2 What is an operating system? Two views: 1. Top-down view: Extended machine ffl Covers the details of the hardwar

Similar documents
CS450/550 Operating Systems

o Reality The CPU switches between each process rapidly (multiprogramming) Only one program is active at a given time

1 System & Activities

SOFTWARE ARCHITECTURE 3. SHELL

Introduction OS

CSI Module 2: Processes

Process. Prepared by Prof. Hui Jiang Dept. of EECS, York Univ. 1. Process in Memory (I) PROCESS. Process. How OS manages CPU usage? No.

System Call. Preview. System Call. System Call. System Call 9/7/2018

Computer Science 330 Operating Systems Siena College Spring Lab 5: Unix Systems Programming Due: 4:00 PM, Wednesday, February 29, 2012

Useful information. Introduction. Outline of the course. Background. References

CS240: Programming in C

Prepared by Prof. Hui Jiang Process. Prof. Hui Jiang Dept of Electrical Engineering and Computer Science, York University

Design Overview of the FreeBSD Kernel. Organization of the Kernel. What Code is Machine Independent?

CS240: Programming in C

Unix Processes. What is a Process?

Operating System Labs. Yuanbin Wu

Introduction SOFTWARE TECHNOLOGIES FOR BIOENGINEERING OS

Operating Systems Comprehensive Exam. Spring Student ID # 3/16/2006

Operating Systems CS 571

Design Overview of the FreeBSD Kernel CIS 657

CSci 4061 Introduction to Operating Systems. Processes in C/Unix

Processes. Process Scheduling, Process Synchronization, and Deadlock will be discussed further in Chapters 5, 6, and 7, respectively.

PROCESS CONTROL BLOCK TWO-STATE MODEL (CONT D)

Layers in a UNIX System. Create a new process. Processes in UNIX. fildescriptors streams pipe(2) labinstructions

Processes. Processes (cont d)

2 Processes. 2 Processes. 2 Processes. 2.1 The Process Model. 2.1 The Process Model PROCESSES OPERATING SYSTEMS

Process Creation in UNIX

UNIX Kernel. UNIX History

Assignment 1. Teaching Assistant: Michalis Pachilakis (

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

Killing Zombies, Working, Sleeping, and Spawning Children

Process Management 1

Operating Systems ( )

Q1. State True/false with jusification if the answer is false:

(MCQZ-CS604 Operating Systems)

3.1 Introduction. Computers perform operations concurrently

Operating Systems ( )

Operating Systems ( )

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

Recitation 8: Tshlab + VM

Jan 20, 2005 Lecture 2: Multiprogramming OS

Mon Sep 17, 2007 Lecture 3: Process Management

Operating Systemss and Multicore Programming (1DT089)

CMPS 111: Introduction to Operating Systems

W4118: OS Overview. Junfeng Yang

Multiprogramming. Evolution of OS. Today. Comp 104: Operating Systems Concepts 28/01/2013. Processes Management Scheduling & Resource Allocation

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

CSC209: Software tools. Unix files and directories permissions utilities/commands Shell programming quoting wild cards files

CSC209: Software tools. Unix files and directories permissions utilities/commands Shell programming quoting wild cards files. Compiler vs.

Operating Systems. Processes. Eno Thereska

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

PROCESS CONCEPTS. Process Concept Relationship to a Program What is a Process? Process Lifecycle Process Management Inter-Process Communication 2.

A2 Design Considerations. CS161, Spring

Operating System Structure

IC221: Systems Programming 12-Week Written Exam [SOLUTIONS]

Course Syllabus. Operating Systems, Spring 2016, Meni Adler, Danny Hendler & Amnon Meisels

Computer System Overview

Announcements Processes: Part II. Operating Systems. Autumn CS4023

Basic OS Progamming Abstrac7ons

Shell Execution of Programs. Process Groups, Session and Signals 1

* What are the different states for a task in an OS?

Basic OS Progamming Abstrac2ons

Chap 4, 5: Process. Dongkun Shin, SKKU

UNIX System Calls. Sys Calls versus Library Func

Operating Systems Comprehensive Exam. Spring Student ID # 3/20/2013

CS 355 Operating Systems. Keeping Track of Processes. When are processes created? Process States 1/26/18. Processes, Unix Processes and System Calls

Processes COMPSCI 386

W4118 Operating Systems. Junfeng Yang

Operating Systems ( )

Interprocess Communication Mechanisms

Interprocess Communication Mechanisms

628 Lecture Notes Week 4

OS COMPONENTS OVERVIEW OF UNIX FILE I/O. CS124 Operating Systems Fall , Lecture 2

UNIX. Session 2. UNIX processes and forking fork system call exec system call death of process kill fork and I/O using it UNIX.

Lesson 3. The func procedure allows a user to choose the action upon receipt of a signal.

Process management. What s in a process? What is a process? The OS s process namespace. A process s address space (idealized)

CSC209 Review. Yeah! We made it!

CSE 451: Operating Systems Winter Module 4 Processes. Mark Zbikowski Allen Center 476

Multitasking. Programmer s model of multitasking. fork() spawns new process. exit() terminates own process

Processes and Exceptions

CISC 7310X. C03: Process. Hui Chen Department of Computer & Information Science CUNY Brooklyn College. 2/15/2018 CUNY Brooklyn College

Midterm Exam CPS 210: Operating Systems Spring 2013

Mid Term from Feb-2005 to Nov 2012 CS604- Operating System

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

Unit 2 : Computer and Operating System Structure

(In columns, of course.)

Operating Systems, Fall

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

Windows architecture. user. mode. Env. subsystems. Executive. Device drivers Kernel. kernel. mode HAL. Hardware. Process B. Process C.

Process control. Game plan: Fork. Scribe notes for 11/11/14 by Diane Yang, Kara Shen, and Chris Lim. fork exec pipes

Processes. CS3026 Operating Systems Lecture 05

Master level: Operating systems, distributed systems, networking,

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

Creating a Shell or Command Interperter Program CSCI411 Lab

CS 31: Intro to Systems Processes. Kevin Webb Swarthmore College March 31, 2016

5/8/2012. Controlling User Processes Chapter 10

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

What is an Operating System? A Whirlwind Tour of Operating Systems. How did OS evolve? How did OS evolve?

Processes. CS 475, Spring 2018 Concurrent & Distributed Systems

CS 322 Operating Systems Practice Midterm Questions

Transcription:

1 A computer system consists of: ffl Hardware Physical devices Λ Processors Λ Memory Λ I/O devices Microprogramming Machine language (instruction set) ffl Software System programs Λ Operating system Λ Compiler Λ Editor Λ Command interpreter Application programs Λ Banking system Λ Airline reservation Λ Games

ESE 333 Real-Time Operating Systems 2 What is an operating system? Two views: 1. Top-down view: Extended machine ffl Covers the details of the hardware ffl Provides more friendly interface to programmers 2. Bottom-up view: Resource manager Consists of four parts: ffl Processor manager ffl Memory manager ffl I/O device manager ffl File manager

ESE 333 Real-Time Operating Systems 3 Types of operating systems: ffl Batch systems: Run jobs one by one to completion. Long turnaround time. ffl Interactive systems: Short turnaround time. Each job uses part of CPU time (quantum) without waiting for others to finish. ffl Real-time systems: The system must respond within a fixed amount of time to ensure correct performance. Used in time critical environments. ffl Hybrid systems: Batch system (background) + Interactive system (foreground). ffl Distributed systems: Distributed computation among several physical processors. The processors do not share memory or a clock. They communicate with each other through communication links.

ESE 333 Real-Time Operating Systems 4 ffl Multiprogramming: Partition memory into several segments with a different job in each partition. Overlap CPU job and I/O job to increase CPU utilization. ffl Time-sharing: A variant of multiprogramming. ffl Difference between batch multiprogramming vs. time-sharing: Batch Time-sharing Obj. Maximize CPU use Minimize response time Instr. Job control language Command from terminal

ESE 333 Real-Time Operating Systems 5 ffl Network O.S. vs. distributed O.S. Network O.S. Λ users are aware of the existence of multiple computers Λ can login to remote machines and copy files from one machine to another Λ each machine runs its own local O.S. and has its own users Distributed O.S. Λ appears to users as a single computer system. Λ users should not be aware of where their programs are being run or where their files are located. Λ O.S. handles them automatically and efficiently.

ESE 333 Real-Time Operating Systems 6 Review: ffl Components of a computer system ffl Definition of O.S.: extended machine + resource manager ffl Multiprogramming ffl Difference between batch multiprogramming and time-sharing system ffl Difference between network O.S. and distributed O.S.

ESE 333 Real-Time Operating Systems 7 Operating System Concepts (Unix system based) Kernel: The kernel is the O.S. It provides services such as ffl file system ffl memory management ffl CPU scheduling ffl I/O Program: an executable file. Process: an instance of a program that is executed by O.S.

ESE 333 Real-Time Operating Systems 8 Process ID: a unique number for each process. Process table: a data structure within the kernel that contains one entry per process including process ID, process state, program counter, CPU registers, memory limits, list of open files, etc. Child process: a process created by other process in Unix. Process tree structure.

ESE 333 Real-Time Operating Systems 9 System calls: a set of extended instructions" provided by O.S., providing the interface between a process and the O.S. Example: Read a certain number of bytes from a file. count = read(fd, buffer, nbytes) File: a collection of data. File types: ffl Regular file (data bytes) ffl Directory (the name of other files) ffl Special file (I/O devices: character, block) Directory tree. File access bits. File descriptor: a small integer used to identify an open file. Pipes: a pseudo file that can be used to connect two processes.

ESE 333 Real-Time Operating Systems 10 Shell: Unix command interpreter. Examples of shell commands: date date > file (output redirection) sort < file (input redirection) sort < file1 > file2 (input + output redirection) cat file1 file2 j sort > file3 (pipe + output redirection)

ESE 333 Real-Time Operating Systems 11 Unix system calls: Extended machine instructions." O.S. provides services to users through system calls. Used for different purposes: ffl System calls for process management fork(): the only way to create a new process in Unix. Create a copy of the process executing it. fork returns 0 in the child, returns child's pid in the parent. exit(status) A process terminates by calling exit system call. status: 0-255, 0: normal, others: abnormal terminations. waitpid(pid, status, opts) pid: specific child, -1: first child. status: child exit status. opts: block or not.

ESE 333 Real-Time Operating Systems 12 execve The only way a program is executed in Unix. s = execve(file, argv, envp) Example: A simplified shell.

ESE 333 Real-Time Operating Systems 13 ffl System calls for signals. Signals are called software interrupts." One process can send signals to another process. Signal names: SIGINT, SIGKILL, SIGALRM,... What to do with a signal system call? Λ Catch a signal: signal(sig, func). Provide a function that is called whenever a specific type of signal occurs. Need to re-enable signal catching. Λ Ignore a signal: signal(sig, SIG IGN). All signal, other than SIGKILL can be ignored. Λ Allow the default to happen: signal(sig, SIG DEF). Normally, a process is terminated when receive a signal. Send a signal: kill(pid, sig).

ESE 333 Real-Time Operating Systems 14 ffl System calls for files read, write create, open and close a file: fd = creat(filename, mode) fd = open(file, how) close(fd) random access a file: pos = lseek(fd, offset, whence) duplicate the file descriptor: fd2 = dup(fd) fd2=dup2(fd, fd2) create a pipe: pipe(&fd[0]) returns two file descriptors: fd[0] : for reading fd[1]: for writing example for using pipe system call.

ESE 333 Real-Time Operating Systems 15 Review: ffl Operating system concepts: kernel, program, process, system calls, file, directory, file protection, pipe and shell. ffl Unix system calls: fork, exit, waitpid.

Review: ffl Unix system calls: execve, signal, kill, read, write, lseek, creat, open, close, dup, pipe. ffl Examples of using system calls: Shell and pipe.

ESE 333 Real-Time Operating Systems 17 Operating System Structure ffl Monolithic systems: O.S. consists of a collection of procedures. All procedures linked together. There is no structure. Interface between the user program and O.S.: kernel call (a trap instruction). General structure model (three levels): Λ main program: call the service procedure Λ service procedures: execute the systems calls Λ utility procedures: some commonly called functions

ESE 333 Real-Time Operating Systems 18 ffl Layered systems: Organize the O.S. into a hierarchy of layers. Example: the THE O.S. system by E.W. Dijkstra (six layers). Λ Layer 0: Processor management: allocate processor, provide multiprogramming. Λ Layer 1: Memory management: allocate memory for processes, paging. Λ Layer 2: Handle communications between processes and console. Λ Layer 3: I/O device management. Λ Layer 4: User programs. Λ Layer 5: System operator process.

ESE 333 Real-Time Operating Systems 19 ffl Virtual machines VM: Virtual machine monitor. Does multiprogramming, providing several virtual machines (VM), each of which is identical to the hardware machine and can run different O.S. CMS: conversational monitor system (a single user O.S.). User process accesses I/O: Λ executes a system call (trap to its own virtual machine). Λ CMS issues the hardware I/O instruction, trapped to VM. Λ VM simulates the hardware.

ESE 333 Real-Time Operating Systems 20 ffl Client-server model Micro kernel. Most of O.S. functions performed at user level. User process (client) sends a request to server process. Kernel handles communication between processes. Allow O.S. to be distributed, more reliable.

ESE 333 Real-Time Operating Systems 21 Review: ffl Internal structure of O.S. Monolithic systems Layered systems Virtual machines Client-server model