1 UNIX 1 History of UNIX 2 Overview of UNIX 3 Processes in UNIX 4 Memory management in UNIX 5 The UNIX file system 6 Input/output in UNIX.

Slides:



Advertisements
Similar presentations
Chapter 3 Process Description and Control
Advertisements

Process Description and Control Module 1.0. Major Requirements of an Operating System Interleave the execution of several processes to maximize processor.
1 Pertemuan 24 Sistem Operasi Unix Matakuliah: T0316/sistem Operasi Tahun: 2005 Versi/Revisi: 5.
Memory Management (II)
1 Case Study 1: UNIX and LINUX Chapter History of unix 10.2 Overview of unix 10.3 Processes in unix 10.4 Memory management in unix 10.5 Input/output.
Ceng Operating Systems 10-1 Chapter 10 : Case Study - UNIX History of unix Overview of unix Processes in unix Memory management in unix Input/output.
Introduction to Kernel
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.
Home: Phones OFF Please Unix Kernel Parminder Singh Kang Home:
Process Management. External View of the OS Hardware fork() CreateProcess() CreateThread() close() CloseHandle() sleep() semctl() signal() SetWaitableTimer()
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.
Process in Unix, Linux and Windows CS-3013 C-term Processes in Unix, Linux, and Windows CS-3013 Operating Systems (Slides include materials from.
1 Process Description and Control Chapter 3 = Why process? = What is a process? = How to represent processes? = How to control processes?
Linux Operating System
1 I/O Management in Representative Operating Systems.
Process Description and Control A process is sometimes called a task, it is a program in execution.
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.
Processes in Unix, Linux, and Windows CS-502 Fall Processes in Unix, Linux, and Windows CS502 Operating Systems (Slides include materials from Operating.
Process Description and Control Chapter 3. Major Requirements of an OS Interleave the execution of several processes to maximize processor utilization.
Chapter 8 Windows Outline Programming Windows 2000 System structure Processes and threads in Windows 2000 Memory management The Windows 2000 file.
CS 6560 Operating System Design Lecture 13 Finish File Systems Block I/O Layer.
Process in Unix, Linux, and Windows CS-3013 A-term Processes in Unix, Linux, and Windows CS-3013 Operating Systems (Slides include materials from.
CSC 322 Operating Systems Concepts Lecture - 4: by Ahmed Mumtaz Mustehsan Special Thanks To: Tanenbaum, Modern Operating Systems 3 e, (c) 2008 Prentice-Hall,
Segmentation & O/S Input/Output Chapter 4 & 5 Tuesday, April 3, 2007.
Introduction to Processes CS Intoduction to Operating Systems.
CASE STUDY 1: Linux and Android Tanenbaum & Bo, Modern Operating Systems:4th ed., (c) 2013 Prentice-Hall, Inc. All rights reserved.
CSE 451: Operating Systems Section 10 Project 3 wrap-up, final exam review.
Chapter 1 Introduction 1.1 What is an operating system
Chapter 7 UNIX and LINUX. 2 Outline Overview Processes in UNIX Memory management in UNIX I/O in UNIX UNIX file system.
The Structure of Processes (Chap 6 in the book “The Design of the UNIX Operating System”)
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.
4P13 Week 3 Talking Points 1. Process State 2 Process Structure Catagories – Process identification: the PID and the parent PID – Signal state: signals.
1 Chapter 10 : Case Study - UNIX History Overview Processes Memory management Input/output in The unix file system Security Note: This case study covers.
MODERN OPERATING SYSTEMS Third Edition ANDREW S. TANENBAUM Chapter 10 Case Study 1: LINUX Tanenbaum, Modern Operating Systems 3 e, (c) 2008 Prentice-Hall,
CSE 5343/7343UNIX Case Study1 CSE 5343/7343 Fall 2006 Case Studies UNIX History/Processes.
GLOBAL EDGE SOFTWERE LTD1 R EMOTE F ILE S HARING - Ardhanareesh Aradhyamath.
Processes, Threads, and Process States. Programs and Processes  Program: an executable file (before/after compilation)  Process: an instance of a program.
The UNIX File System (1) Some important directories found in most UNIX systems.
UNIX & Windows NT Name: Jing Bai ID: Date:8/28/00.
Process Description and Control Chapter 3. Source Modified slides from Missouri U. of Science and Tech.
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 Structure of Processes Chapter 6 Process State and Transition Data Structure for Process Layout of System Memory THE DESIGN OF THE UNIX OPERATING SYSTEM.
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.
Chapter 1 Introduction  What is an operating system  History of operating systems  The operating system zoo  Computer hardware review  Operating system.
What is a Process ? A program in execution.
Processes and Threads Chapter 3 and 4 Operating Systems: Internals and Design Principles, 6/E William Stallings Patricia Roy Manatee Community College,
WORKING OF SCHEDULER IN OS
MODERN OPERATING SYSTEMS Third Edition ANDREW S
Introduction to Kernel
SLC/VER1.0/OS CONCEPTS/OCT'99
Processes and threads.
Case Study 1: UNIX and LINUX
Structure of Processes
Avani R.Vasant V.V.P. Engineering College
Protection of System Resources
CASE STUDY 1: Linux and Android
Processes in Unix, Linux, and Windows
Structure of Processes
OPERATING SYSTEMS DESIGN AND IMPLEMENTATION Third Edition ANDREW S
An overview of the kernel structure
Processes in Unix, Linux, and Windows
CS703 - Advanced Operating Systems
Process Description and Control
Lecture Topics: 11/1 General Operating System Concepts Processes
Processes in Unix, Linux, and Windows
COMP755 Advanced Operating Systems
Structure of Processes
The UNIX Time Sharing System
Presentation transcript:

1 UNIX 1 History of UNIX 2 Overview of UNIX 3 Processes in UNIX 4 Memory management in UNIX 5 The UNIX file system 6 Input/output in UNIX

2 History of UNIX MULTICS and UNICS (Thompson) PDP-11 UNIX (B & C, Richie & Tompson) Portable UNIX Berkeley UNIX Standard UNIX Linux (Linus Torvald)

3 UNIX Goals An interactive system designed to handle multiple pro- cesses and multiple (sophisticated) users at the same time Group of experienced users != personal computer model Experienced users want: –simplicity, elegancy, consistency –power and flexibility –avoid useless redundancy

4 Interfaces to UNIX The layers of a UNIX system. User Interface

5 UNIX Shell (Φλοιός) Shell: a command line interface != X Windows Faster to use, more powerful, easily extensible When the shell starts up: initializes it self, types a prompt character. User: types a command line. Shell: extract first word -> program to execute. Shell is just another program Commands may take arguments, e.g. cp a1.txt b1.txt Other aspects: flags, wildcards e.g. –2, */? Standard input, output, error. Redirection ( ). –e.g. sort tmp; head –30 < temp; rm temp Output of a program is input to another. Pipes (|) –e.g. sort < in | head –30 Multiple commands: e.g. sort tmp &. Shell scripts.

6 UNIX Utility Programs A few of the more common UNIX utility programs required by POSIX

7 Processes in UNIX Processes are created using the fork system call Parent and child processes have their own, private memory images. Open files are shared between the two processes How do the processes know which one should run the parent code and which one should run the child code?

8 POSIX The signals required by POSIX. Processes communicate with each other: using a form of message passing (pipes) and with signals

9 System Calls for Process Management s is an error code pid is a process ID residual is the remaining time from the previous alarm

10 POSIX Shell A highly simplified shell

11 UNIX Processes: Implementation Two data structures: process table and user structure Process table (keeps information for all processes): –Scheduling parameters (process priority, amount of CPU time consumed recently, sleeping time recently) –Memory image (pointers to text, data and stack segments) –Signals (masks showing treatment of signals) –Miscellaneous (process state, event being waited for, PID, etc.) User structure (only if process in memory and runnable) –Machine registers –System call state –File descriptor table (used to locate the i-nodes) –Accounting (CPU used so far)

12 The ls Command Steps in executing the command ls type to the shell

13 UNIX Scheduler Designed to provide good response to interactive processes Two-level algorithm –Low-level: picks the process to run next from the runnable ones –High level: moves processes between memory and disk Low level algorithm: –Uses multiple queues, each with a range of priorities values –Processes in user mode have positive values, kernel mode negative –A process run for a quantum (usually 100msec) or until it blocks and then it is put on the end of the queue –Every second: priority = CPU_usage + nice + base

14 UNIX Scheduler The UNIX scheduler is based on a multilevel queue structure

15 Booting UNIX The sequences of processes used to boot some systems cp The boot program located in the MBR runs first and loads the O.S.

16 Handling Memory Process A's virtual address space (text,data and stack) Physical memory Process B's virtual address space (text, data and stack) Process A Process B

17 System Calls for Memory Management s is an error code b and addr are memory addresses len is a length prot controls protection flags are miscellaneous bits fd is a file descriptor offset is a file offset

18 Implementation of Paging in UNIX On-demand No prepaging Page daemon OS, core map and page frames The core map has an entry for each page Earlier UNIX systems used swapping (low-level scheduling)

19 Page Replacement in UNIX When a page fault occurs and the there is no available page, process is suspended until page daemon has freed some. Page replacement algorithm is executed by page daemon; every 250 msec it checks if free pages >= lotsfree parameter If not, it transfers pages to disk so free pages >= lotsfree Modified version of the clock algorithm; global replacement Two-hand clock algorithm: the page daemon maintains two pointers into the core map. When it runs, it first clears the usage bit at the front end and then checks the usage bit at the back end, after which it advances both hands.

20 The UNIX File System Some important directories found in most UNIX systems

21 The UNIX File System Before linking. After linking. (a) Before linking. (b) After linking

22 The UNIX File System Separate file systems After mounting (a) (b) (a) Before mounting. (b) After mounting

23 Locking Files (a) File with one lock (b) Addition of a second lock (c) A third lock Exclusive and Shared Locks: similar to read and write locks

24 System Calls for File Management s is an error code fd is a file descriptor position is a file offset

25 The lstat System Call Fields returned by the lstat system call.

26 System Calls for Directory Management s is an error code dir identifies a directory stream dirent is a directory entry

27 UNIX File System Disk layout in classical UNIX systems

28 UNIX File System Directory entry fields. Structure of the i-node

29 UNIX File System Example: n = read (fd, buffer, nbytes) When kernel gets control, all it has is just 3 parameters. It has to locate the i-node. Also store the file position. One of the internal tables: file descriptor array One possibility: have a pointer to the i-node at the file descriptor and keep file position in the i-node. FAILS (?) Another possibility: keep file position in the file descriptor array. What happens if a child process modifies the file? Introduce a new table, the open file description between the file descriptor table and the i-node table.

30 UNIX File System The relation between the file descriptor table, the open file description

31 UNIX I/O System All I/O devices are made to look like files and are accessed with the same read/write system calls. UNIX integrates I/O devices to the file system as special files. E.g. /dev/hd1 (hard disk), /dev/lp1 (printer), /dev/net. Programs can read/write special files the same way with regular files. E.g. cp account.txt /dev/lp1 Special files: –block: sequence of numbered blocks (e.g. disks) –character: input or output character streams (e.g. keyboard, printer)

32 Networking Sockets are analogous to mailboxes or wall sockets and are used for networking Sockets are created (returns a file descriptor) and destroyed dynamically Each socket supports: –reliable connection-oriented byte stream (equivalent of a pipe between 2 processes) –reliable connection-oriented packet stream (preserves packet boundaries) –unreliable packet transmission (access to the raw network – no guarantees) Before a socket can be used, it must have an address

33 Terminal Management The main POSIX calls for managing the terminal

34 UNIX I/O Some of the fields of a typical cdevsw table

35 UNIX I/O The UNIX I/O system in BSD