Software Hierarchy Software Development software System software Application software • compilers • interpreters • editors • debuggers • Integrated • Development • Environments • (IDE) • word processing • presentation • spreadsheet • database • desktop publishing • multimedia • communication • graphics Utility Programs Device Drivers Operating system Shell Kernel Allow input/output devices to communicate with programs and other system components
The Components of System Software Operating system - the principal component of system software Device drivers - help the computer control peripheral devices Utility programs - support, enhance, or expand existing programs
Structure of the OS • The operating system shell includes the user interface (UI). • Users only interact with the OS through the UI. • The UI can be • Command/character-based (e.g., DOS or UNIX) • Graphical user interface (GUI), involving windows, menus, icons, etc. kernel kernel - program which remains in main memory while the computer is running, and directs other “nonresident” programs to perform tasks that support application programs
What Is an Operating System? • The operating system: • A collection of programs that help you use the computer. • Acts as a smart assistant that moves controls the flow of information to various components and other programs. • Manages the usage, storage, and access of programs, data, and processes. Common Tasks Performed by the OS
Where is the OS Stored? • Where does the operating system reside? • ROM (Read Only Memory) • ROM is “non-volatile” memory that contains the skeleton operating system, along with information about where the OS is stored on the Hard disk or other external storage. • The skeleton operating system allows use of keyboard and both floppy and hard disk drives. • RAM (Random Access Memory) • The main part of the operating system is transferred from a secondary storage (e.g., hard disk) to RAM when the computer is first turned-on. • This is called the “booting process” or “boot-up”. • After the boot-up, a portion of RAM is taken up by the OS and other system software, while other portions are available for loading application software or data.
The Booting Process (BIOS) BIOS stands for: basic input/output system basic input/output system (RAM)
The Booting Process (BIOS) (RAM)
Main Operating System Functions • Task management • preparing, scheduling, and monitoring of tasks for continuous processing by the CPU • Memory management • allocation of memory for various tasks; transfer of data and programs from external storage to memory and back; virtual memory management; cache management • Device management • controlling flow of data to an from input/output devices, and management of device drivers • File and data management • controlling how files are created, accessed, organized, copied, and modified; controlling and managing the storage of data in external storage devices • System monitoring • monitoring of system resources and devices; error detection and recovery
Some Terminology • Process • A process is an instance of a program running in a computer. In Unix and some other operating systems, a process is started when a program is initiated. A process is a running program with which a particular set of data is associated so that the process can be kept track of. • Task • A task is a basic unit of processing that an operating system controls. A process may be a single task or may involve multiple tasks that are performed together or consecutively.
Task Management Concepts • Multi-tasking: • Running more than one task (or process) simultaneously. • Each process “stealing” or sharing CPU time. • Such as playing a game while a large document is being printed. • Each process is allocated a CPU time slice; at the end of the time slice the process in “interrupted” and its “state” is saved until the CPU can come back to the process; CPU is then allocated to the next process on the queue. • Context Switching: • Switching from one process or one user to another. • Such as from a word processor to a spreadsheet and back again (both reside in RAM).
Multi-tasking CPU Time shared between process A and process B
Task Management Concepts • The Process States The process life cycle
Task Management Concepts • CPU Scheduling: Determining which process in the ready state should be moved to the running state • That is, decide which process should be given over to the CPU • The operating system must manage a large amount of data for each active process • Usually that data is stored in a data structure called a process control block (PCB) • Each time a new process is moved to the running state: • The CPU must store the intermediate data for the currently running process into its PCB. • Then, the CPU most load the running state of the new process from its PCB (this is loaded into special memory devices inside the CPU called “registers”). • This exchange of information is what we call a context switch
Task Management Concepts • Multi-Programming: • Same as multi-tasking, but there are multiple users that are running programs (e.g., multiple users logged in on the same computer). OS needs to be able to switch context and allocate CPU and memory resources among multiple users. • Parallel processing (Multiprocessing): • Computing that is done with more than one CPU. • Several processors or CPUs are simultaneously computing a program. • Load Balancing: OS tries to manage the allocation of tasks to multiple CPUs, in order to optimize the load on each processor. • Scaling: OS needs to be able to break up tasks into independent units that can be processed simultaneously by different processors. • Distributed processing: • Makes use of a network. • Decentralizes and distributes the computing needs over several interconnected computers. • Requires a “network operating system” that can handle allocation and management of tasks across the network among multiple computers.
Memory Management Concepts • At any point in time memory is divided into a set of partitions, some empty and some allocated to running processes. • A portion of the memory is always reserved for the operating system and other system processes. • When a process is activated, its memory address (location of the first instruction in the program) and the total space (length) for the process are stored the CPU registers. • This way, the CPU will know how to get back to the process as it switches among different running processes.
Memory Management Concepts • Cache memory • If the primary memory were as large as ever needed, the following ideas would not be necessary. • Cache memory: Addresses the concerns of speed and efficiency (two types). • 1. Disk cache - saves the most frequently used parts of the program being run or executed in the RAM memory - it will be there ready to go (very fast). • 2. RAM disk - fools the program into thinking it is accessing the disk, but instead the needed information has been transferred to RAM (RAM is much faster than disk access).
Memory Management Concepts • Virtual Memory • addresses the problem of a program (or multiple programs) being too big to fit into the available RAM. • The operating system divides the program into pieces. • The pieces are stored on the hard disk. • The pieces are retrieved into RAM as needed. • Disadvantage: This slows the system down, because retrieval of information from the disk is time consuming.
File Management Concepts • A file is a named collection of related data • A file system is the logical view that an operating system provides so that users can manage information as a collection of files • A file system is often organized by grouping files into directories (Folders) • Most files, whether they are in text or binary format, contain a specific type of information • For example, a file may contain a Java program, a JPEG image, or an MP3 audio clip • The kind of information contained in a document is called the file type • Most operating systems recognize a list of specific file types
File Management Concepts • File names are often separated, usually by a period, into two parts • Main name • File extension • The file extension indicates the type of the file File Types Some common file types and their extensions File Operations • Create a file • Delete a file • Open a file • Close a file • Read data from a file • Write data to a file • Rename a file • Copy a file • Move a file
File Management Concepts • File Protection • In multi-user systems, file protection is of primary importance • We don’t want one user to be able to access another user’s files unless the access is specifically allowed • A file protection mechanism determines who can use a file and for what general purpose • A file’s protection settings in the Unix operating system is divided into three categories: Owner, Group, World (all users)
File Management Concepts • A directory of files can be contained within another directory • The directory containing another is usually called the parent directory, and the one inside is called a subdirectory • The directory at the highest level is called the root directory • A file system is often viewed as a directory tree • At any point in time, you can be thought of as working in a particular location (that is, a particular subdirectory) • This subdirectory is referred to as the current working directory Directory Trees
Path Names • A particular file is identified by specifying that file’s path, which is the series of directories through which you must go to find the file • An absolute path name begins at the root and specifies each step down the tree until it reaches the desired file or directory • A relative path name begins from the current working directory • Examples of absolute paths: C:\Program Files\MS Office\WinWord.exe C:\My Documents\letters\applications\vaTech.doc C:\Windows\System\QuickTime • Suppose the current working directory is C:\My Documents\letters Then the following relative path name applications\depaul.doc Corresponds to the absolute path: C:\My Documents\letters\applications\depaul.doc
Disk Scheduling • File systems must be accessed in an efficient manner • As a computer deals with multiple processes over a period of time, a list of requests to access the disk builds up • The technique that the operating system uses to determine which requests to satisfy first is called disk scheduling
Disk Scheduling • First-Come, First-Served Disk Scheduling • In FCFS, we process the requests in the order they arrive, without regard to the current position of the heads • The shortest-seek-time-first (SSTF) disk-scheduling • moves the heads the minimum amount it can to satisfy any pending request • SCAN Disk Scheduling • An elevator is designed to visit floors that have people waiting. Elevator moves from one extreme to the other (top of the building to the bottom), servicing requests as appropriate. • The SCAN disk-scheduling works in a similar way, except instead of moving up and down, the read/write heads move in toward the spindle, then out toward the platter edge, then back toward the spindle, and so forth.
System Software - Utility Programs • Backup utility • program which makes a duplicate copy of the information on your hard disk • Data-recovery utility • program which restores data that has been physically damaged or corrupted • Antivirus software • program that scans hard disks, floppy disks, and memory to detect viruses • Data compression utility • program which removes redundant elements, gaps, and unnecessary data from a computer’s storage space so that less space (fewer bits) is required to store or transmit data • Disk cleanup utilities • Detect & remove unnecessary files • Detect & correct disk problems
System Software - Utility Programs • Fragmentation - the scattering of portions of files about the disk in nonadjacent areas, thus greatly slowing access to the files • Defragmenter utility - program that finds all the scattered files on your hard disk and reorganizes them as contiguous files
Development Software • Computers can only understand instructions that are in machine language • Machine language instructions are binary encoded operations that make up a program • Programmers, however write programs in a high-level language, not in binary • A special program, called a “translator” needs to be used to convert the high-level language source code into binary machine code that the computer understands. The machine code program is called the “object” program. • Two types of translators: • Compilers: translate the whole source code into machine code in one step. After the translation, the machine code can be executed as a single program. • Interpreters: translate and execute the source code one statement at a time. The processing is done interactively.
Development Software The “Compilation” Process