Chapter 3 – Operating Systems Aims: Identify the main operating system characteristics. Define typical operating systems. To classify operating systems. Define the component parts of an operating system. Contrast a thread-based approach with processes. User interface, operating system and hardware User Userinterface: interface: ••Microsoft MicrosoftWindows Windows(Windows (Windows95/98/NT/2000). 95/98/NT/2000). ••Microsoft Windows 3.1. Microsoft Windows 3.1. ••X-Windows. X-Windows. Operating Operatingsystem: system: ••Microsoft Windows Microsoft Windows(Windows (Windows95/98/NT/2000). 95/98/NT/2000). ••DOS. DOS. ••UNIX/Linux. UNIX/Linux. ••VMS. VMS. ••Novell NovellNetWare. NetWare. Hardware: Hardware: ••x86 x86architecture. architecture. ••SPARC SPARCarchitecture. architecture. ••Apple architecture. Apple architecture. Typical operating systems DOS. This was one of the first operating systems for the PC, and quickly become a standard, not because of its technical specifications, but because of its relative cheapness against the other PC operating systems. Microsoft Windows 3.x. This was basically a graphical user interface (GUI), which used DOS as its operating system, and thus still had all the major problems of DOS (such as only being able to run 16-bit software, only being able to access a limited amount of memory, no networking, and so on). Microsoft Windows. In the mid-1980s, Microsoft spent a good deal of time working with IBM on OS/2. Unfortunately the partnership broke up, and Microsoft used their experience from this project and fed it into Microsoft NT Version 3.0. This was a radical redesign of an operating system for the PC. The next version of NT used the graphical user interface developed with Windows 95. Newer versions of Windows have included Windows 98, Windows ME and Windows 2000/XP, and each has built on the robustness, networking infrastructure and GUI of its parents (Windows 95 and NT). Typical operating systems (cont.) UNIX. A powerful and robust operating system, which is typically used in high-powered workstations. It has a kernel, which interfaces to the hardware. This kernel has the advantage that it can be stripped away from the GUI and can be run on its own. Novell NetWare. Around the time of DOS and Microsoft Windows 3.1, there was very little software which allowed computers to be connected to a network. VMS. As with UNIX, a powerful and robust operating system. It is excellent at running batch processes, which are automatically started when the system is started. They then run quietly with little user input (typically described as batch processes). Linux. A version of UNIX for the PC, and one of the few PC-based operating systems to properly compete with Microsoft Windows. Operating system components User account database Users Operating system Groups Kernel Kern Kernaal l Volumes File system Resources Memory Printer Print Queues Printer Server Operating system characteristics Single-user Multi-user Stand-alone Networked Single-tasking Multitasking Single processor Multi-processor Operating system classifications • Single user v. Multi-user. Single-user systems only allow a single user to login into the system at a time. They have no user account database, and have a low level of security, as users cannot protect their files from being viewed, copied or deleted. • Networked v. Stand-alone. A stand-alone computer does not connect to a network, and thus cannot access any networked resources. This obviously creates a more secure environment as remote users cannot log into the computer. • Multitasking v. Single-tasking. Multitasking operating systems allow for one or more programs, or processes, to be run, at a time. Typically, this is achieved by giving each process a prioritized amount of time on the processor. • Multiprocessor v. Single processor. Some operating systems allow for more than one processor to be used on the system. This allows more than one task to be run, at a time, on different processors. Windows server operating systems supports multiprocessors (up to four processors). Operating system classifications (cont.) • Embedded v. Non-embedded. An embedded operating system is typically integrated into a device, and is used to perform a specific task, and support for specific applications. Embedded systems are especially written for certain applications and for a narrow range of additional hardware. • Distributed processing v. Localized processing. Most processing is achieved locally within the computer system (localized processing), but some processing can be distributed to other computers. Operating system functions Memory: - Creating virtual memory systems - Disk swapping for memory Device interfacing: - Access to connected devices - Multi - user access - Device drivers UNIX LINUX Microsoft Windows 95/98 (OS) Microsoft Windows NT (OS) Hardware Mac OS Networking: - Remote login/file transfer - Creating global file systems File system: - Creating a file system - Copying/deleting/moving files DOS Multi-user - Allowing users to log into the system - Allowing users permissions to certain resources - Manag ing queues for resources Multiprocessing - Allowing several processes to run, at a time - Scheduling of processing to allow priority Operating system functions File system. All operating systems create and maintain a file system, where users can create, copy, delete and move files around a structured file system. Device interfacing. Operating systems should try and hide the complexity of interfacing to devices from user programs and the user. Multi-user. This allows one or more users to log into the system. For this, the operating system must contain a user account database, which contains user names, default home directories, user passwords, user rights, and so on. Multitasking. This allows for one or more tasks to run on a system, at a time. Typically this is achieved by giving each task a certain amount of time on the processor (known as a quanta time slice), and the state of the task at the end of the quanta is stored to memory, and recalled when it is next run. Operating system functions Multiprocessing. This allows two or more processors to be used, at a time. When running with more than one processor the operating system must decide if it can run the processes on the different processors, or it has to determine if the processes require to be run sequentially (that is, one at a time). Multi-threaded applications. Processes are often split into smaller tasks, named threads. These threads allow for smoother process operation. Threads of a program use a common area for their data. They allow smaller processes to run, as larger processes will typically get stuck waiting for resources to be freed, or data to be inputted. Multiple access to devices. Some devices allow many programs to access it, without causing any problems, while others require that only one program at a time can have access. Memory and disk access allow multiple access for programs, whereas modems and printers typically only allow one program to access them at a time. Operating system functions Driver loading. A device driver is a special piece of software which knows how to communicate with a specific device. For example a mouse driver will know how to receive data from a mouse and then convert it into a form which can be used by a program. An operating system is thus responsible for loading device drivers, and making sure that they act reliably. Managing memory. This involves allocating memory to processes, and often involves creating a virtual memory for programs.Virtual memories were an invention of the VMS operating system, where programs could be given an almost infinite amount of memory, even though there was a limited physical memory. Networking. Typically an operating system must make provision to create a network either to connect to an external network (such as the Internet), or in a local network (or domain). This normally involves loading the required networking protocol, such as TCP/IP for communications with the Internet. Pre-emptive or co-operative • Pre-emptive multitasking. This type of multitasking involves the operating system controlling how long a process stays on the processor. This allows for smooth multitasking and is used in 32-bit Microsoft Windows programs and in the UNIX operating system. • Co-operative multitasking. This type of multitasking relies on a process giving up the processor. It is used with Windows 3.x programs and suffers from processor hogging, where a process can stay on a processor and the operating system cannot kick it off. Communication between processes Process Process Data passed between processes Process Process Message or signal Interrupt Interrupt Low-level Low-level interrupt interrupt Low-level Low-level interrupt interrupt Network or local computer Pre-emptive multitasking Come Comeon. on.My My turn soon turn soon 2 3 Processor 1 Okay OkayNo.1, No.1,you’ve you’ve had your turn, had your turn, get gettotothe theback backofof the thequeue. queue.Next! Next! 4 5 Process queue Pre-emptive multitasking: Processes are given some time on the processor. This allows all the processes to have some time on the processor, and makes for smoother and more reliable operation Co-operative multi-tasking Hurray. Hurray.I Icould could stay here forever. stay here forever. Anyway, Anyway,I’m I’m not going back not going backtoto the theend endofofthe thequeue. queue. Hurry Hurryup. up.I’m I’m waiting. You’ve waiting. You’ve been beenon onthat that processor processor for forages. ages. 1 2 Processor Sorry. Sorry.You’ll You’llhave havetoto wait waituntil untilhe’s he’s finished finished 3 4 Process queue Co-operative multitasking: Processes must yield from the processor, before other processes can run on the processor This Thisisn’t isn’t very fair! very fair! 5 6 Operating system components Application program Application program Communication with operating system Operating System Kernel Network driver Keyboard driver Soundcard driver Mouse driver Video driver Threads in a task Boil Boil potatoes potatoes Microwave Microwave the thepie pie Pie is cooked Potatoes are soft Put Put pie pie on onplate plate Put Put potatoes potatoes on onplate plate Boil Boil carrots carrots Carrots are soft Put Put carrots carrots on onplate plate Threads v. processes Process approach Threads approach Interlinking of threads Process Process splits into threads Threads Independent threads Common sharing of data between threads