6-on-1 - Lecture Notes 1 Basic Concepts Topics (Chapter 1)...

Info iconThis preview shows page 1. Sign up to view the full content.

View Full Document Right Arrow Icon
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: Lecture Notes 1 Basic Concepts Topics (Chapter 1) • Operating system functions • Concept of system calls (user mode vs. supervisor mode execution) • Hardware organization • Handling of interrupts, exceptions, and traps • Multiprogramming • Shell programs • Brief history of UNIX development What is an Operating System? (Chapter 1 -- Section 1.1) What is an Operating System? Goals of an Operating System Resource Manager • Hardware resources – CPU, Primary memory, – I/O devices, Network devices – Disk space; • Software resources – Files, Processes, Network Ports etc. • Schedule activities of programs using these resources. • Correct and efficient use of shared resources • Efficient utilization of system resources: Implement different kinds of scheduling policies. • Synchronization of concurrent access to shared resources. • Protection of resources and information. • Provide high level abstractions for programming with system resources. • Accounting of resource usage. • Communication and coordination in networked systems. What is an Operating System? Control Program • Control the execution of user programs • Protection or resources • Prevent user programs from performing unauthorized operations; • Only authorized user should be able to login on the system and use resources. • Accounting and charging for resource usage What is an Operating System? Extended machine • Extend the functionality and abstraction of the underlying hardware: – Disk vs. Files – Assembly level code vs. High level languages – Coroutines vs. Processes – Network packets vs. Reliable Connection – Command line shell vs. Graphical User Interface What is an OS Kernel? • • • An operating system KERNEL is simply a collection of code and data structures. Typically, in systems such as UNIX, it is not an active entity. It is reactive: it reacts to activities of running processes and the peripheral (I/O) devices. – Devices (keyboard, mouse, disk, network interface) cause hardware interrupt and the kernel respond to such interrupts. – An executing process requests a service from the kernel by making a system call. Computer Organization Processor Architecture (Section 1.3 and 1.5) (Section 1.3) • • • • • • ALU - Arithmetic and Logic Unit Program Counter Stack pointer Data registers Cache memory (Level 1 0n-chip, and Level 2) Memory management related registers: – Base/Bound registers, Page Table Pointer – Address translation registers (Translation Lookaside Buffer TLB) Program vs. Process • A program represent a code, which is a sequence of instructions. • A process is an entity which represents a program in execution. • A process needs resources for its execution: – CPU, memory, input/output files or devices, • Process Execution Context: • An executing process has a "context" which represents its current execution status. • It contains Program Counter, stack pointer, and other CPU registers Device Controllers Device Interrupts I/O DEVICE ADDRESSING At the architecture level, two approaches for addressing I/O devices: • Memory Mapped I/O: The device controller registers are accessed by the CPU as part of memory address range. Reading/writing a memory address is done by reading/writing to a memory address. – Motorola 680x0 series microprocessors • Special Address Space for I/O: I/O controller registers are addressed using addresses separate from memory addresses. – Intel processors I/O DEVICE ADDRESSING on IBM PCs DMA Controller Interrupt Controller Clock timer Keyboard Game controller Serial port (secondary) Disk controller Parallel port Graphics controller Floppy disk controller Serial port 000 - 00F 020 - 02F 040 - 043 060 - 063 200 - 20F 2F8 - 2FF 320 - 32F 378 - 37F 3D0 - 3DF 3F0 - 3F7 3F8 - 3FF Device Interrupts Exceptions and Traps Traps and System Calls System Calls (Section 1.6) User Mode vs. Supervisor Mode of Execution User Mode vs. Supervisor Mode of Execution Examples of System Calls Examples of System Calls... Examples of System Calls... Examples of System Calls... Examples of System Calls... Handling of Interrupts/Traps Handling of Interrupts/Traps Unix Kernel Runtime Structure User Process System call System call execution runs until blocked to get a resource. Otherwise, it is never preempted to run another process A system call may get interrupted by a device interrupt may block itself using sleep Interrupt handler Interrupt Vectors Device Table and Request Queues Synchronous vs. Asynchronous I/O Synchronous vs. Asynchronous I/O Multiprogramming Multiprogramming Concurrent Processes and Virtual Computer abstraction • Each concurrent processes can be viewed to be executing on its own dedicated “virtual computer”. • This virtual computer contains the following information which defines the process execution context: – Program code – Current execution context – Address space – Execution stack – Arguments given to the program – Input/output streams Multiprogramming Memory Protection Virtual Computer Example - a process running “sort” program Concurrent Processes Command Shell • When a user logs in, a process is created to executed a shell program. • A shell program is a command interpreter. • The user’s keyboard is connected to the shell process’s standard output. • User’s screen display is connected to the shell process’s standard output. • Certain commands typed by the user are executed by the shell itself. • For other kinds of commands it may created a new process to execute system programs. Standard Input and Output Command Shell and System Programs • Certain commands typed by the user are executed by the shell itself. • For other kinds of commands it may created a new process to execute system programs. • For example in UNIX, there are system programs for commands such as ls, ps, date, wc, head, tail, chmod, chown, grep, more, vi, sed, emacs, … System Booting Hard Disk Partitions • The first sector of hard disk is used for booting. • It contains the Master Boot Record Typical disk layout with multiple partitions Partition 1 MBR Partition 2 Partition 3 Partition Table Boot Sector Boot Sector Typical disk layout with multiple partitions • MBR Boot block Partition 1 Super block Freespace info Partition 2 inodes Root dir Partition 3 Files and directories MBR (Master Boot Record) – This is the sector 0 of the disk and it is used to boot the computer. – The end of MBR contains the disk partition info. – One of the partitions is marked as active. • MBR locates the active partition and reads the boot block from the active partition. • The program in the boot block loads the operating system code contained in the partition. – Partitions may contain different kinds of file systems. The superblock of the file system in a partition contains the parameters for the file system. Operating System Developments (Section 1.2) History of Unix Development • Early 1960s MIT developed the first time-sharing system called CTSS (Compatible Time Sharing System). • Based on that experience, in mid 1960s MIT, General Electric, and Bell Labs started the MULTICS (MULTIplexed Information and Computing System). • Bell Labs withdrew from this project. • Ken Thompson of Bell Labs, who worked on Multics, decided to implement a highly stripped down version of Multics on a PDP-7. Moving Unix of PDP 11 • PDP 11/20 and PDP 11/45 were relatively more powerful and provided memory protection. – PDP 11/20 had 256 KB of memory – PDP 11/45 had 2 MB memory • Both these minicomputers had 16 bits of address. That gave 64 KB of data space, and 64 KB for instruction. • PDP-7 version was written in assembly language. • Thompson decided to write the new version in a high level language. For that he picked B language, a derivative of BCPL. Operating System Developments... From MULTICS to UNICS • Some Bell Lab researchers called his system UNICS (UNIplexed Information and Computing Service). This name stayed around and the spelling was changed to UNIX. • This PDP-7n version was indeed found to be functionally useful. A number of people were impressed by this work. • Dennis Ritchie joined Ken Thompson to implement this new operating system on PDP 11/20 and then later to PDP 11/45. Development of C Language • Because the B language lacked certain features (namely structures), Thompson designed an improved version of it and called it C. • Thompson and Ritchie rewrote Unix using C. • The published a paper together, in 1974, describing the Unix system. This attracted attention of many university researchers to get a copy of Unix for their PDP 11 machines. • The source code was easily available for students and teachers to study and examine. Development of Version 7 Berkeley UNIX • A number of version of the Unix system were developed. • Version 6 had 8200 lines of C code and 900 lines of assembly code. • A small system like this was easy for one person to study and manage. • Version 7 was designed to be a portable version. It had 18,800 lines of C code and 2100 lines of assembly code. • By 1980 Unix was in widespread use at many universities. • University California at Berkeley obtained Version 6 of Unix an designed an improved version called 1BSD (First Berkeley Software Distribution) for PDP 11. This was followed by 2BSD. • Most significant was 4BSD for VAX. • Bell Labs developed a VAX version called 32V, which was basically Version 7. • 4BSD added many new features. 4BSD UNIX • It was funded by DARPA • 4 BSD (with its several releases 4.1BSD, 4.2BSD, 4.3BSD, 4.4BSD) added many new features. – – – – – Virtual memory improved file system implementation improved signal management - more reliable Support for TCP/IP protocol suit Several utility programs • Many companies such as Sun Microsystems based their official version of operating system on Berkeley UNIX. Sun OS 4.1 • During mid 1980s multiprocessor systems started appearing in the market and there was need to support such systems. • SunOS 4.1 provided asymmetric multiprocessing: – The kernel ran only on one processor. – User processes could be scheduled on any other available processor. – This kind of system did not scale well Sun OS • Sun’s operating system for its first workstation Sun-1 was a port of BSD Unix. • SunOS 1.0 was based on BSD 4.1 in 1982. • It was implemented on Motorola 68000 microprocessors. • By mid 1980s, Sun Microsystem put many new innovations in its SunOS 2.0 operating system: – NFS (Network File System) – RPC (Remote Procedure Call) – Memory mapped files Development of System V Release 4 • After 1984, AT&T released its first commercial Unix, which was called System III. • Its improved version, System V was later released. • Subsequently there were several releases, called release 2, 3 and 4. • In 1993, AT&T sold its UNIX business to Novell, which later sold it to Santa Cruz Operation in 1995. Development of System V Release 4 SVR4 SVR3 SunOS System V Release 4 BSD Xenix POSIX Standard • By mid 1980s there were two UNIX camps: AT&T’s System V and BSD UNIX. • A software developed could not run on another. • This posed difficulties to software vendors. • An effort was initiated under IEEE to develop a standard interface of system calls. • This standard is known as POSIX (Portable Operating System). • This standard is known as 1003.1 • It specifies the system call interface definitions. Does not prescribe how to implement them. Hardware Organization Solaris CPU • For supporting multiprocessors, Sun Microsystems embarked on the development of a multithreaded operating system. • Supported both kernel level and application level threads. • It supported fine-grained locking in the kernel. • The main objective was scalability. • This new kernel and SVR4 became the foundation of Solaris 2.0 operating system. • Solaris 7 provided full support for 64-bit processor architectures. Level 2 Cache Graphics board PCI Bridge/ controller IDE controller Model Buses Disks Monitor SCSI interface Memory ISA Bridge Parallel port Keyboard Other Buses Buses Plug-n-Play ...
View Full Document

This note was uploaded on 03/06/2012 for the course CSCI 5103 taught by Professor Staff during the Fall '08 term at Minnesota.

Ask a homework question - tutors are online