NETW3005 Operating Systems Lecture 1: Introduction and history of O/Ss General The Computer Architecture section SFDV2005 is now complete, and today we begin on NETW3005 Operating Systems. Lecturers: Give lecturers details: Name, room, email, etc... Reference Book: Operating System Concepts with Java A. Silberschatz, J. Galvin and G. Gagne. John Wiley 1
Lectures Participate, think, criticize, learn! Not all material can be covered in lectures. You are expected to do 12hrs/wk for this course, leaving 6hrs for readings and assignments. Any readings are examinable! Copies of the overheads will be handed out at each lecture. 2
Tutorials and internal assessment Tutorials are an integral part of the course. The tutorial for each lecture will be handed out during the lecture. Each tutorial is worth 0.5%. This mark is awarded for participation in the tutorials. Summary of internal assessment: Tutorial marks: 6% in total. Three assessed Quizzes each worth 3%. Midterm exam worth 20%. Total: 35%. 3
NETW3005 Course overview Introduction (1 lecture) Process Management (5 lectures) System Structure and Processes Threads and data sharing Scheduling Synchronisation Deadlocks Storage Management (2 lectures) Main memory Virtual memory File System Interface (1 lecture): I/O Management (2 lectures) I/O systems Mass storage 4
Learning about Operating Systems Knowing about Operating Systems will change the way you work with a computer. Knowing about low-level architecture issues doesn t make a big impact on how you use a computer dayto-day. But knowing about operating systems does. Getting to grips with terminology... Some gobbledegook: One multi-threaded process uses fewer resources than multiple redundant processes, including memory, open files, and CPU scheduling. For example, as Solaris evolves, network daemons are being rewritten as kernel threads, to increase greatly the performance of those network server functions. (From an earlier edition of Silberschatz et al.) 5
What is an Operating System? Defn 1: an operating system is a program which acts as an intermediary between the hardware and the user. user 1 user 2.... user n text editor compiler system and application programs database program OPERATING SYSTEM computer hardware What Paul was talking about. What I ll be talking about. An operating system makes life more convenient for the user, because she doesn t have to operate at the level of machine instructions. 6
What is an Operating System? Defn 2: an operating system is a program that controls all of the system s resources, and decides how these are to be allocated. The resources of a computer system include... CPU time Memory /storage Control of I/O devices One role of an operating system is to improve the efficiency with which the computer s resources are used, if there s heavy demand on them. 7
What is an Operating System? Defn 3: an operating system is a program which is always running on a machine while it is in operation. When the machine is started up, a bootstrap program is run, to initialise various things, and then the machine s kernel program is executed. The kernel basically cycles waiting for events to occur. 8
What is an Operating System? Defn 4: an operating system is MS-DOS, Windows 98, UNIX, MacOS, etc. This isn t just a kernel program; it also includes a whole set of application programs that are compatible with this kernel and are typically used in a particular environment. This is a colloquial use of the word operating system, and we won t be using it. 9
What is an Operating System? Here s the definition which we ll use to structure the course: Defn 5: an operating system is a program that manages the different aspects of the operation of the machine. Manages processes running on the machine. Manages data storage on the machine. Manages the user interface. Manages input/output devices associated with the machine. Manages security and protection issues. Manages networks and provides communication with other machines. 10
Process Management Defn: a Process is a program in execution. A program is not a process! A program in execution is. Process management involves: creating and deleting processes suspending and resuming processes process synchronisation process communication deadlock handling 11
Storage Management The term storage covers primary storage (main memory), secondary storage (hard disk), tertiary storage) (floppy disks, tapes, CDs). Storage management involves: Allocating and deallocating storage Keeping track of storage in use and free storage Transferring data between primary and secondary storage 12
User Interface Defn: the shell is the program through which the user interacts with the operating system. Two common types of shell: Icon-based point-and-click system (e.g. MacOS, MS Windows) Simple to learn and use. Keyboard-entered commands (e.g. UNIX) Harder to learn, but more powerful and flexible. The shell is (obviously) the aspect of an operating system which is most evident to the user. But in fact it s only a very small part of it. Defn: the file system is the mechanism by which the user accesses/manipulates stored data. 13
I/O Device Management A computer system can include a very wide range of I/O devices: keyboards, mice, printers, hard disks, CD-roms, etc etc etc. I/O device management includes tasks like: tracking the status of each device allocating devices to particular processes deallocating devices scheduling tasks for individual devices (e.g. scheduling) disk 14
The first computer systems The first computers didn t have operating systems: there was no intermediary system between the programmer and the hardware the programmer gave instructions directly to the CPU. However, this meant that the CPU was idle for most of the time. 15
Batch operating systems The first operating systems were introduced to increase the efficiency of (I/O) processes. Programmers didn t deal directly with these machines: instead, they prepared their programs as jobs, and submitted their jobs to operators. It wasn t possible to interact with a program while it was executing. Operators grouped jobs together and submitted batches of jobs to the machine. The computer then needed an operating system to transfer control automatically from one job to another. These early batch operating systems were still inefficient: I/O processing is still very slow in comparison to CPU processing; While I/O is occurring, the CPU is still idle. 16
Spooling A solution to the I/O bottleneck is to perform I/O for one job J 1 at the same time as the CPU is executing another job J 2. This is known as spooling. In this scenario, we need a secondary storage medium: somewhere to store the jobs being input to the system; somewhere to store the output from jobs in the system. The secondary storage medium is a disk. Disk Card Reader CPU Printer 17
The Job Pool Spooling introduces a key concept for modern operating systems: the job pool. Disk Job1 Job2 Job3 Job4 Job5... CPU If there are several jobs spooled onto the disk, the system can decide which one to execute next. In a simple batch system, the jobs are stored on a disk, and processed sequentially: the operating system only decides which one to run next. There are still inefficiencies in this setup. Jobs often have to wait for a task to complete. While this is happening, the CPU is again idle. 18
Multiprogrammed Batch Systems In a multiprogrammed batch system, several jobs are held in main memory; when one job has to wait for some I/O task, the operating system switches the CPU to another job, keeping track of where it left off the first job. This way, the CPU can be busy for more of the time. Disk Job 1 Job 3 Main memory Operating System CPU Job 2 Job 4...... I/O......... I/O... I/O Job 5... I/O...... In this scenario, the operating system has quite a lot of responsibility. 19
Time Sharing Systems So far we have just been considering batch (i.e. noninteractive) programs. However, the concept of multiprogramming can be applied to interactive programs too. An interactive program is constantly checking for user input while it is running. If several interactive programs are multiprogrammed, and the CPU switches fast between them, they behave as though they are being run independently, on several (slower) CPUs. This type of system is called a time-sharing, or multitasking system. The big mainframes used time sharing, simply because CPUs were very expensive, and it paid to be able to share a single CPU among several users. 20
Personal Computer Systems In the 70s, it became economically feasible to have a single computer for each user. Early PC systems had no need for multi-tasking; only 1 process at a time. Hence they just required a simple operating system. MS-DOS is a product of this era. As PCs became more powerful, it became feasible to include more sophisticated O/S services on PCs (e.g. multi-tasking). The central concern is no longer just CPU utilisation: equally important are user interface issues. (Even a single user wants lots of interactive jobs running simultaneously.) Operating systems of this kind include MacOS, Microsoft Windows, UNIX. 21
Parallel Systems and distributed systems In a parallel operating system, there are multiple CPUs. The CPUs share a common bus, clock, memory, and devices. Improvements in performance, and in reliability. Some extra factors to consider: Special techniques are required to ensure no conflicts arise (e.g. writing to disk at the same time). The increased throughput isn t linear on the number of processors. In a distributed system, computation is distributed among several processors. Processors do not share memory or a clock. They communicate via data lines. Examples include a LAN, the WWW. Advantages are similar to the advantages of parallel systems. 22
Real-time systems In some domains, there are rigid time requirements for processes to complete. For these domains, a real-time operating system is required. Hard real-time systems: guarantee that jobs be completed within specified times. (This typically means that advanced operating-system features aren t used.) Soft real-time systems: some jobs have higher priorities than others, and high priority jobs are processed preferentially. Summary: Types of Operating System Batch systems Time sharing systems Personal computer systems Parallel systems Distributed systems Real time systems 23