Chapter 5 OPERATING SYSTEM: MS-DOS AND WINDOWS What is an OS? It is an extended machine (interface to the 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 OS for 4th Generation Computers Personal computers Mainframe operating systems CP/M (Control Program for Microcomputers) Server operating systems DOS (Disk Operating System) MSDOS OS/390, OS/360 UNIX, Windows 2000/XP, Linux Multiprocessor operating systems Windows XP, Linux, Dynix Real-time operating systems VxWorks, QNX GUI (Graphical User Interface) Windows UNIX: Windows 95/98/Me, Windows NT, Windows 2000, Windows XP X Windows, Motif Linux, Gnome, KDE Embedded operating systems Smart card operating systems PalmOS, Pocket PC for PDA, Windows Mobile, Symbian OS Java Virtual Machine (JVM) on the smart card Functions of operating system 1. 2. 3. 4. 5. 6. Process management Memory management File management Device management Security management User Interface (Command Interpretation) What is a process? A process is an execution of a program by the processing unit. Several tasks of MS Word- • editing the document • the user may start printing a spreadsheet • read data from CD-ROM A process requires certain resources like CPU time allocation, memory space, files and I/O devices. Managing the process assigned by the user and accomplishing all the tasks by making proper and efficient use of hardware resources. What is process life-cycle? When there are processes running on a computer, operating system allocates certain amount of time to each process for making use of the processor. So, the process may be at different stages of execution. These are - Running, ready and waiting. Running – the process which is allowed by the operating system to use the processor. Ready – the process which can run when the processor becomes free. Waiting – the running process which is interrupted after completing its allotted time and kept waiting (to be processed later). The change of the state from one to another is known as context change and the action is known as context switching. What is process scheduling? In a multiprogramming environment the processor is required to handle many processes at a given time and these processes are to be the processor time, which is known as scheduling. Two most popular implementation of scheduling are – First in First out (FIFO) and Round Robin First in First out and (FIFO) – In this system, all the available processes are kept in queue. When the first one is dispatched to the processor all other processes move up one slot in the queue. In this approach, a process may take up long time to complete and holds up other processes in the queue. Round Robin – In this approach, a process is allowed to run for a fixed period of time known as time slicing, after which it is interrupted and sent to the end of the queue. Queues at process Characterization of Scheduling Policies The scheduler (scheduling procedure) determines which ready process is selected next for execution The decision mode specifies the instants in time the selection function is exercised Nonpreemptive • Once a process is in the running state, it will continue until it terminates or blocks for an I/O Preemptive • Currently running process may be interrupted and moved to the Ready state by the OS • Prevents one process from monopolizing the processor First Come First Served (FCFS) Selection function: the process that has been waiting the longest in the ready queue (hence, FCFS) Decision mode: non-preemptive a process runs until it blocks for an I/O Favors CPU-bound processes A CPU-bound process monopolizes the processor I/O-bound processes have to wait until completion of CPUbound process I/O-bound processes may have to wait even after their I/Os are completed (poor device utilization) Better I/O device utilization could be achieved if I/O bound processes had higher priority Round-Robin Decision mode: preemptive a process is allowed to run until the time slice period (quantum, typically from 10 to 100 ms) has expired a clock interrupt occurs and the running process is put on the ready queue Still favor CPU-bound processes An I/O bound process uses the CPU for a time less than the time quantum before it is blocked waiting for an I/O A CPU-bound process runs for all its time slice and is put back into the ready queue May unfairly get in front of blocked processes Deadlock Process is deadlocked if it is waiting for an event that will never occur Most common situation is where two processes are involved on is holding resource required by the other and also looking for resource held by the other process. Alamgir locks AB123 Bibi Russel lock AB456 Alamgir requests AB456 Bibi Russel requests AB123 Deadlock prevention means that deadlock will not occur due to fact that we deny one of the 4 conditions necessary. Deadlock avoidance attempts to predict the possibility of deadlock as each resources request is made. Example if process A requests a resource held by process B then make sure that process B is not waiting for resource held by A (Banker’s algorithm) Memory Management Part of the operating system that manages the memory of a computer is known as memory manager. Memory protection Ensures that that memory location allocated to one process is not being used by any other process. The operating system keeps track of the memory space assigned to each program. Two major tasks are involved in memory management: • allocation of memory space to each process; and • effective utilization of different types of memory. Virtual memory Virtual memory acts like a main memory to the user, although it is no real memory. A part of the secondary storage device (like hard disk) is linked with the main memory through the referenced page pf a program and made available to the user, when necessary. File Management It may also be described as information management because information • is stored in the system in the form of files. Process can read information • from files and can create new files for newly generated information. File manager of the operating system is responsible for maintenance of the file system; • providing directories for organizing files; and • providing a protection mechanism to allow different users to access information stored in different files. Device Management Device management module of an operating system controls all the I/O devices of a computer. For example, a printer is recognized and used through the operating system. Objective keeps track of I/O requests from processor Issue command to the I/O devices Ensure correct data transmission to and from I/O devices. • • • SPOOLING SPOOL stands for Simultaneous Peripheral Operation On-line. It refers to putting jobs in a buffer memory where a device can access them when it is ready. The processor send the data very fast and the buffer provides a waiting space while the slower device catches up. The most common spooling application is print spooling. Security Management This module of operating system provides protection against data corruption (or destruction) and unauthorized access. Two major security techniques are: data backup and user authentication (like the use of password) • • User Interface Command interpretation module (also known as command interpreter) of an operating system serves as an interface for the user to communicate with the computer via its operating system. Two types of interface may be provided to the user. (i) Command Line Interface (CLI) – Here the user gives user to the computer by typing commands line by line. DOS and UNIX are the examples of the operating system providing CLI. (ii) Graphical User Interface (GUI) – Here the command is graphical or pictorial. User can give commands by clicking icons and opening dialog boxes. Commands are selected by moving a pointer (generally by using mouse). WINDOWS and LINUX are the examples of GUI based operating systems. Utilities Utility programs- Assist the users with the system maintenance tasks. Common utilities Disk formatting Disk compaction Disk cleanup Data compression Data backup Data recovery Virus protection Firewall • • • • • • • • • Performance Monitoring/ Profiler- Analyzing the performance of • various hardware components • overall performance of a computer system. • Information • % of CPU utilization • % of memory utilization • number of disk accesses Common DOS commands dir [name of directory] dir allows you to list all contents of the specified directory Mkdir- Make directory cd <directory name> cd is the basic DOS command, it allows you to change directory copy <source> <destination> Allows you to copy a file from a <source> folder to a <destination folder> del<file> Deletes a specific file move <source> <destination> Allows you to move a file from a <source> folder to a <destination folder> ren <source> <destination> Renames the specified file exit Leaves the DOS terminal Common DOS commands … edit <filename> Opens the default DOS editor to allow modification of a specified file cls Clears the DOS screen Assignments IOA, IA, GA, Case !@#$