1 Operating-System Structures Operating System & its purpose Operating Systems lead to new Hardware...

30
1 Operating-System Structures Operating System & its purpose Operating Systems lead to new Hardware Features System Components System Services System Calls System Programs

Transcript of 1 Operating-System Structures Operating System & its purpose Operating Systems lead to new Hardware...

Page 1: 1 Operating-System Structures Operating System & its purpose Operating Systems lead to new Hardware Features System Components System Services System Calls.

1

Operating-System Structures• Operating System & its purpose• Operating Systems lead to new Hardware Features• System Components• System Services• System Calls• System Programs

Page 2: 1 Operating-System Structures Operating System & its purpose Operating Systems lead to new Hardware Features System Components System Services System Calls.

2

Operating System

• Operating System– An Operating System is a program that acts as an

intermediary between a user of a computer and the computer hardware

• Purpose– Operating System provide an environment in which a

user can execute programs

Page 3: 1 Operating-System Structures Operating System & its purpose Operating Systems lead to new Hardware Features System Components System Services System Calls.

3

How Operating System lead to new Hardware Features

• Simple Batch System– Large machine run from a console,

– Input through card reader or tape

– Out put through line printers

• Multi-programmed Batched System– The OS keeps several jobs in memory at a time

• Time-Sharing or Multitasking Systems– Switching between jobs, user may interact

• Personal Computers Systems

Page 4: 1 Operating-System Structures Operating System & its purpose Operating Systems lead to new Hardware Features System Components System Services System Calls.

4

How Operating System led to new Hardware Features

• Parallel or Multi-processor Systems– More than one processor, sharing the computer bus, clock,

memory and peripheral devices – Tightly coupled systems

• Distributed Systems– Distribute computation among several processors, do not

share memory or clock, every processor has its own local memory

• Real Time Systems– When there is rigid requirement on the operation of a

processor or flow of data, control devices

Page 5: 1 Operating-System Structures Operating System & its purpose Operating Systems lead to new Hardware Features System Components System Services System Calls.

5

System Components

• Designing a OS is critical task depends on defining goals

• Different point of views of OS– What services OS provide & how these are provide

– Interface it make available to user and programmer

– Sub system components integration & their interactions

– What are the various methodologies for designing such systems

Page 6: 1 Operating-System Structures Operating System & its purpose Operating Systems lead to new Hardware Features System Components System Services System Calls.

6

System Components• Process Management• Main Memory Management• File Management• I/O System Management• Secondary Storage Management• Networking• Protection system• Command Interpreter System

Page 7: 1 Operating-System Structures Operating System & its purpose Operating Systems lead to new Hardware Features System Components System Services System Calls.

7

System Components• Process Management

– A process is a set of instruction or program in execution– Batch, system task (spooling output to a printer)– Process needs certain resources including CPU time,

memory and I/O devices to accomplish its tasks

• OS is responsible for the following activities w.r.t process management– Creation and deletion of user and system program– Suspension and resumption of process– Provision of mechanism for process communication and

also for deadlock handling

Page 8: 1 Operating-System Structures Operating System & its purpose Operating Systems lead to new Hardware Features System Components System Services System Calls.

8

System Components• Main Memory Management

– Central to operation of computer system– Quickly & Directly accessible – CPU read and write data into main memory– When retrieval from hard disk is required – first data loaded into

main memory by I/O calls

• OS is responsible for the following activities w.r.t Main Memory Management– Keep track of which part of memory are currently being used & by

whom– Decide which process are to be loaded into memory when memory

space is available– Allocate or de-allocate memory space as needed

Page 9: 1 Operating-System Structures Operating System & its purpose Operating Systems lead to new Hardware Features System Components System Services System Calls.

9

System Components• File Management

– Abstract form of physical properties of its storage devices to define logical storage

– Collection of related information/ data which may numeric or alphabetic

– Visible component of an OS stored in magnetic disk or tapes with different physical organization depends on speed, capacity, rate etc

• OS is responsible for the following activities w.r.t Main File Management– Creation or deletion of files/ directories– Manipulating files and directories– Mapping of files onto secondary storage– Back up of files on to non volatile media

Page 10: 1 Operating-System Structures Operating System & its purpose Operating Systems lead to new Hardware Features System Components System Services System Calls.

10

System Components• I/O System Management

– OS purpose is to hide complexities from user

– I/O complexities are hidden from bulk of OS itself by the I/O subsystem

• I/O System consists of – Buffering, caching and spooling

– A general device driver interface

– Driver for specific hardware devices

Page 11: 1 Operating-System Structures Operating System & its purpose Operating Systems lead to new Hardware Features System Components System Services System Calls.

11

System Components• Secondary Storage Management

– Permanent storage– All data is stored – Computer system must provide for permanent storage as

back up for RAM

• OS is responsible for the following activities w.r.t Secondary Storage Management– Free space management– Storage allocation– Disk scheduling

Page 12: 1 Operating-System Structures Operating System & its purpose Operating Systems lead to new Hardware Features System Components System Services System Calls.

12

System Components• Networking

– Distributed system is collection of process do not share memory, devices, clock

– Each process has its own memory and clock– LAN, WAN configuration, Homogenous/

Heterogeneous environment– Processors connected through high speed line or

telephone lines– Consider routing, connection strategies & securities– Communication and data sharing is made

Page 13: 1 Operating-System Structures Operating System & its purpose Operating Systems lead to new Hardware Features System Components System Services System Calls.

13

System Components

• Protection system– Refers to mechanism for controlling the access of

program, process or users to the resources defined by a computer system

– Computer system have multiple users– Allow concurrent execution of programs– Protection is required– E.g Files, Memory segments, CPU, Other resources– Only authorize persons can access– Improve reliability - make system healthy

Page 14: 1 Operating-System Structures Operating System & its purpose Operating Systems lead to new Hardware Features System Components System Services System Calls.

14

System Components• Command Interpreter system

– Interface between user & system – MS DoS - Kernal – Windows GUI, Mouse , Key board - Shell

Page 15: 1 Operating-System Structures Operating System & its purpose Operating Systems lead to new Hardware Features System Components System Services System Calls.

15

Operating System Services

• Objective– To describe the services an operating system

provides to users, processes, and other systems– To discuss the various ways of structuring an

operating system– To explain how operating systems are installed

and customized and how they boot

Page 16: 1 Operating-System Structures Operating System & its purpose Operating Systems lead to new Hardware Features System Components System Services System Calls.

16

Operating System Services– User interface - Almost all operating systems have a user

interface (UI)• Varies between Command-Line (CLI), Graphics User

Interface (GUI)– Program execution - The system must be able to load a

program into memory and to run that program, end execution, either normally or abnormally (indicating error)

– I/O operations - A running program may require I/O, which may involve a file or an I/O device.

– File-system manipulation - The file system is of particular interest. Obviously, programs need to read and write files and directories, create and delete them, search them, list file Information, permission management.

Page 17: 1 Operating-System Structures Operating System & its purpose Operating Systems lead to new Hardware Features System Components System Services System Calls.

17

Operating System Services (Cont.)– Communications – Processes may exchange information, on the same

computer or between computers over a network• Communications may be via shared memory or through message

passing (packets moved by the OS)– Error detection – OS needs to be constantly aware of possible errors

• May occur in the CPU and memory hardware, in I/O devices, in user program

• For each type of error, OS should take the appropriate action to ensure correct and consistent computing

• Debugging facilities can greatly enhance the user’s and programmer’s abilities to efficiently use the system

Page 18: 1 Operating-System Structures Operating System & its purpose Operating Systems lead to new Hardware Features System Components System Services System Calls.

18

Operating System Services (Cont.)

– Resource allocation - When multiple users or multiple jobs running concurrently, resources must be allocated to each of them• Many types of resources - Some (such as CPU

cycles, main memory, and file storage) may have special allocation code, others (such as I/O devices) may have general request and release code.

– Accounting - To keep track of which users use how much and what kinds of computer resources

Page 19: 1 Operating-System Structures Operating System & its purpose Operating Systems lead to new Hardware Features System Components System Services System Calls.

19

Operating System Services (Cont.)

– Protection and security - The owners of information stored in a multi-user or networked computer system may want to control use of that information, concurrent processes should not interfere with each other• Protection involves ensuring that all access to

system resources is controlled• Security of the system from outsiders requires user

authentication, extends to defending external I/O devices from invalid access attempts

• If a system is to be protected and secure, precautions must be instituted throughout it. A chain is only as strong as its weakest link.

Page 20: 1 Operating-System Structures Operating System & its purpose Operating Systems lead to new Hardware Features System Components System Services System Calls.

20

User Operating System Interface - GUI

• Many systems now include both CLI and GUI interfaces– Microsoft Windows is GUI with CLI “command” shell

• User-friendly desktop metaphor interface– Usually mouse, keyboard, and monitor

– Icons represent files, programs, actions, etc

– Various mouse buttons over objects in the interface cause various actions (provide information, options, execute function, open directory or folder

Page 21: 1 Operating-System Structures Operating System & its purpose Operating Systems lead to new Hardware Features System Components System Services System Calls.

21

System Calls• System calls are the programming interface to the services

provided by the OS

• Typically written in a high-level language (C or C++)

• Mostly accessed by programs via a high-level Application Program Interface (API) rather than direct system call use

• Three most common APIs are Win32 API for Windows, POSIX API for all versions of UNIX, Linux, and Mac OS, and Java API for the Java virtual machine (JVM)

Page 22: 1 Operating-System Structures Operating System & its purpose Operating Systems lead to new Hardware Features System Components System Services System Calls.

22

Example of Standard API

•A description of the parameters passed to ReadFile()– HANDLE file—the file to be read– LPVOID buffer—a buffer where the data will be read into and written

from– DWORD bytesToRead—the number of bytes to be read into the buffer– LPDWORD bytesRead—the number of bytes read during the last read– LPOVERLAPPED ovl—indicates if overlapped I/O is being used

Consider the ReadFile() function in theWin32 API—a function for reading from a file

Page 23: 1 Operating-System Structures Operating System & its purpose Operating Systems lead to new Hardware Features System Components System Services System Calls.

23

API – System Call – OS Relationship

Page 24: 1 Operating-System Structures Operating System & its purpose Operating Systems lead to new Hardware Features System Components System Services System Calls.

24

Types of System Calls

• Process control– End, Abort, Load, Execute– Create/ Terminate process– Get/Set process attributes– Wait event, Signal event– Allocate & Free memory

• File manipulation– Create/ Delete file– Open, Close, Read, Write– Get/ Set File attribute

• Device manipulation– Request/ Release Device– Read, Write, Reposition– Logically attach or detach devices

Page 25: 1 Operating-System Structures Operating System & its purpose Operating Systems lead to new Hardware Features System Components System Services System Calls.

25

Types of System Calls

• Information maintenance– Get/ Set time or date– Get/ Set System data– Get/ Set process, file, or device attribute

• Communications– Create/ Delete communication connection– Send/ Receive messages– Transfer status information– Attach or detach remote devices

Page 26: 1 Operating-System Structures Operating System & its purpose Operating Systems lead to new Hardware Features System Components System Services System Calls.

26

Steps in Making a System Call

There are 11 steps in making the system call read (fd, buffer, nbytes)

Page 27: 1 Operating-System Structures Operating System & its purpose Operating Systems lead to new Hardware Features System Components System Services System Calls.

27

System Programs• System programs provide a convenient environment for

program development and execution. Some of them are simply user interfaces to system calls; others are considerably more complex

• The can be divided into:– File manipulation – Status information– File modification– Programming language support– Program loading and execution– Communications– Application programs

Page 28: 1 Operating-System Structures Operating System & its purpose Operating Systems lead to new Hardware Features System Components System Services System Calls.

28

System Programs (cont’d)

• File manipulation –

– Create, delete, copy, rename, print, dump, list, and generally manipulate files and directories

• Status information

– Some ask the system for info - date, time, amount of available memory, disk space, number of users

– Others provide detailed performance, logging, and debugging information

– Typically, these programs format and print the output to the terminal or other output devices

Page 29: 1 Operating-System Structures Operating System & its purpose Operating Systems lead to new Hardware Features System Components System Services System Calls.

29

System Programs (cont’d)

• File modification

– Text editors to create and modify files

– Special commands to search contents of files or perform transformations of the text

• Programming-language support

– Compilers, assemblers, debuggers and interpreters sometimes provided

Page 30: 1 Operating-System Structures Operating System & its purpose Operating Systems lead to new Hardware Features System Components System Services System Calls.

30

System Programs (cont’d)

• Program loading and execution– Absolute loaders, , linking, and execution, debugging

systems for higher-level and machine language• Communications

– Provide the mechanism for creating virtual connections among processes, users, and computer systems

– Allow users to send messages to one another’s screens, browse web pages, send electronic-mail messages, log in remotely, transfer files from one machine to another

• Application Programs– OS provide programs that solve common problem or

perform common operations– Web browser, word processor, spread sheets, databases