module 1 introduction to operating system - 2014

23
Module 1 - Introduction Hemang Kothari Assistant Professor Computer Engineering Department MEFGI, Rajkot. Email: [email protected] Slides: http://www.slideshare.net/hemangkothari Computer Engineering Department - MEFGI 1 30-Dec-13

Upload: hemang-kothari

Post on 06-May-2015

1.230 views

Category:

Education


1 download

DESCRIPTION

Concept of OS, What is OS, Functionalities

TRANSCRIPT

  • 1.Module 1 - Introduction Hemang Kothari Assistant Professor Computer Engineering Department MEFGI, Rajkot. Email: [email protected] Slides: http://www.slideshare.net/hemangkothari 30-Dec-13Computer Engineering Department - MEFGI1

2. Content What is an OS ? Evolution Of OS. OS Services. Types Of OS. Concepts of OS. Different Views Of OS.30-Dec-13Computer Engineering Department - MEFGI2 3. The Big Picture30-Dec-13Computer Engineering Department - MEFGI3 4. More ..30-Dec-13Computer Engineering Department - MEFGI4 5. What is an Operating System It is an extended machine Hides the messy details which must be performed Presents user with a virtual machine, easier to use It is a resource manager Each program gets time with the resource Each program gets space on the resource 30-Dec-13Computer Engineering Department - MEFGI5 6. Evolution of Operating Systems (1)Early batch system 30-Dec-13bring cards to 1401 read cards to tape put tape on 7094 which does computing put tape on 1401 which prints output Computer Engineering Department - MEFGI6 7. Evolution of Operating Systems (2) First generation 1945 - 1955 vacuum tubes, plug boards Second generation 1955 - 1965 transistors, batch systems Third generation 1965 1980 ICs and multiprogramming Fourth generation 1980 present personal computers 30-Dec-13Computer Engineering Department - MEFGI7 8. Evolution of Operating Systems (3) Multiprogramming system three jobs in memory 3rd generation30-Dec-13Computer Engineering Department - MEFGI8 9. Types of Operating System Mainframe operating systems Server operating systems Multiprocessor operating systems Personal computer operating systems Real-time operating systems Embedded operating systems Smart card operating systems30-Dec-13Computer Engineering Department - MEFGI9 10. OS Services Program execution Error handling Job sequencing Input/output operations Interrupt handling File system manipulation Scheduling Resource Allocation Accounting of computer resources Protection30-Dec-13Computer Engineering Department - MEFGI10 11. Lets dig it Program execution: Users are interested in executing programs. The system must be able to load a program into memory and run it. The program must be able to end its execution, either normally or abnormally. Error handling: For each type of error, the operating system should take the appropriate action to assure correct ant consistent computing. Example: Power failure in the CPU or memory. Parity error on tape. Printer out of paper. Arithmetic overflow. Access illegal memory location. 30-Dec-13Computer Engineering Department - MEFGI11 12. Continue .. Job sequencing: The system must determine the sequence in which jobs should be processed. In the first operating systems to transfer control from one Job to the next, a Job Control language interpreter(a command interpreter) had to be used. Input / output operations: Since a user program cannot execute I/O operations directly, the O.S. must provide some means to do so. Interrupt handling: Operating systems are event driven programs. If there are no programs to execute, no I/O devices to service, and no user to respond to, an O.S. will sit quietly, waiting for something to happen. Events are almost always signaled by the occurrence of an interrupt or trap. 30-Dec-13Computer Engineering Department - MEFGI12 13. Services Continue File system manipulation: Users will be able to create, delete, read, or write files. Scheduling: The system has to decide when to introduce new processes into the system and the order in which processes should run. Resource Allocation: When there are multiple process running concurrently, resources must be allocated to each one of them. 30-Dec-13Computer Engineering Department - MEFGI13 14. Still Services Accounting of computer resources: The operating system must keep track of the type and amount of resources used by each user. This information can be used for the purpose of paying for the use of the system or for accumulating usage statistics. Protection: When several processes are being executed concurrently to increase CPU utilization, it should not be possible for one process to interfere the others 30-Dec-13Computer Engineering Department - MEFGI14 15. OS Concepts - Process Definition A program in execution Consists of: executable code, data, stack, CPU registers value, and other information A process hierarchy (tree) A created two child processes: B and C B created three child processes: D, E, and F Process synchronization Inter-Process Communication (IPC) 30-Dec-13Computer Engineering Department - MEFGI15 16. System Calls Definition a call to an OS service a trap into the OS code Programs want the OS to perform a service Access a file Create a process Others Examples of system calls File manipulation: open(), read(), write(), lseek(), close() File system management: mkdir(), mount(), link(), chown() Process management: fork(), exec(), wait(), exit() 30-Dec-13Computer Engineering Department - MEFGI16 17. Making a system call 0xffffffffLibrary (read call)Return to caller Trap to kernel 3 Trap code in registerUser space82 4Increment SP97 System call: read(fd,buffer,length) Program pushes arguments, calls library Library sets up trap, calls OS OS handles system call Control returns to library Library returns to user programCall read 1 Push argumentsKernel space (OS)Dispatch 030-Dec-1356 Sys call handlerUser code Computer Engineering Department - MEFGI17 18. System Calls Examples CallDescriptionfd = open(name,how)Open a file for reading and/or writings = close(fd)Close an open filen = read(fd,buffer,size)Read data from a file into a buffern = write(fd,buffer,size)Write data from a buffer into a files = lseek(fd,offset,whence)Move the current pointer for a files = stat(name,&buffer)Get a files status information (in buffer)s = mkdir(name,mode)Create a new directorys = rmdir(name)Remove a directory (must be empty) Create a new entry (name2) that points to the same object as name1 Remove name as a link to an object (deletes the object if name was the only link to it)s = link(name1,name2) s = unlink(name)30-Dec-13Computer Engineering Department - MEFGI18 19. More system calls CallDescriptionpid = fork()Create a child process identical to the parentpid=waitpid(pid,&statloc,options)Wait for a child to terminates = execve(name,argv,environp)Replace a process core imageexit(status)Terminate process execution and return statuss = chdir(dirname)Change the working directorys = chmod(name,mode)Change a files protection bitss = kill(pid,signal)Send a signal to a processseconds = time(&seconds)Get the elapsed time since 1 Jan 197030-Dec-13Computer Engineering Department - MEFGI19 20. DeadlockActual DeadlockPotential Deadlock 30-Dec-13Computer Engineering Department - MEFGI20 21. Memory Management The memory management function keeps track of the status of each memory location, either allocated or free. It determines how memory is allocated among competing processes, deciding who gets memory, when they receive it, and how much they are allowed. When memory is allocated it determines which memory locations will be assigned. It tracks when memory is freed or unallocated and updates the status. 30-Dec-13Computer Engineering Department - MEFGI21 22. Input / Output Management Components controller and the device itself Controller Directly controls the physical device Receives commands from the OS Device driver Supplied by controller manufacturer Inserted into the OS run in kernel mode Functionality Busy waiting Interrupts30-Dec-13Computer Engineering Department - MEFGI22 23. File System30-Dec-13Computer Engineering Department - MEFGI23