introduction to OS

  • Computer software can be divided into two main categories: application software and system software.
  • The most important type of system software is the operating system. An operating system has three main responsibilities:
  1. Perform basic tasks, such as recognizing input from the keyboard, sending output to the display screen, keeping track of files and directories on the disk, and controlling peripheral devices such as disk drives and printers.
  2. Ensure that different programs and users running at the same time do not interfere with each other.
  3. Provide a software platform on top of which other programs (i.e., application software) can run.
  • four common types of operating system strategies on which modern operating systems are built: batch, timesharing, personal computing, and dedicated.
  • Some examples of resources are processors (CPUs), input/output devices, files, and memory (RAM).
  • The operating system manages resources (resource allocation) and provides an interface to resources for application programs (resource abstraction).
  • Some resources can only be shared through time-multiplexing, that is, each program receives control of the resource for a certain period of time. Other resources, like RAM, can be shared through space-multiplexing. In this case, each program receives a certain amount of the resource which it can use
  • Resource abstraction is the process of “hiding the details of how the hardware operates, thereby making computer hardware relatively easy for an application programmer to use”
  • A program is merely a static set of directions and the activity of executing a program is a dynamic activity whose properties change as time progresses known as a process.
  • To keep track of the state of all the processes, the operating system maintains a table known as the process table. Inside this table, every process is listed along with the resources the processes is using and the current state of the process. Processes can be in one of three states: running, ready, or waiting.
  • The running state means that the process has all the resources it need for execution and it has been given permission by the operating system to use the processor. Only one process can be in the running state at any given time.
  • The remaining processes are either in a waiting state (i.e., waiting for some external event to occur such as user input or a disk access) or a ready state (i.e., waiting for permission to use the processor).
  • The responsibility of determining how to allocate processor time among all the ready processes is known as scheduling.
  • One approach to scheduling known as preemptive scheduling: “this task is accomplished by dividing time into short segments, each called a time slice or quantum (typically about 50 milliseconds), and then switching the CPU’s attention among the processes as each is allowed to execute for no longer than one time slice.” This procedure of swapping processes is called a process switch or a context switch.
  • Another approach to scheduling is non-preemptive scheduling. In this approach, processes are give control of the processor until they complete execution or voluntarily move themselves to a different state.
  • Three strategies for process scheduling are First Come First Serve, Round Robin, and Shortest Process Next.
  • In addition to process scheduling, another important responsibility of the operating system is process synchronization. Synchronization involves the orderly sharing of system resources by processes.
  • Critical Resource: a resource shared with constraints on its use (e.g., memory, files, printers, etc.)
  • Critical Section: code that accesses a critical resource
  • Mutual Exclusion: at most one process may be executing a Critical Section with respect to a particular critical resource simultaneously
  • Deadlock: both processes hold a resource the other process needs, the processes will wait indefinitely for the resources to be released and neither will finish executing.
  • The operating system must efficiently manage the primary memory of the computer called the memory manager.
  • The memory manager is responsible for allocating primary memory to processes and for assisting the programmer in loading and storing the contents of the primary memory. Managing the sharing of primary memory and minimizing memory access time are the basic goals of the memory manager.
  • Various different strategies are used to allocate space to processes competing for memory, three of the most popular are Best fit, Worst fit, and First fit.
  • Virtual memory strategies allow a process to use the CPU when only part of its address space is loaded in the primary memory. In this approach, each process’s address space is partitioned into parts that can be loaded into primary memory when they are needed and written back to secondary memory (hard disk) otherwise.
  • Whenever a page fault occurs, the memory manager must decided which page to swap out of primary memory in order to load the requested page. Various different algorithms are employed.
  1. Random Replacement
  2. First In First Out
  3. Second Chance
  4. Least Recently Used
  5. Least Frequently Used
  • Another part of the operating system is the file manager. It is responsible for the maintenance of secondary storage (e.g., hard disks).
  • The file manager:
  1. implements this abstraction (Each file is a named collection of data stored in a device) and provides directories for organizing files.
  2. provides a spectrum of commands to read and write the contents of a file, to set the file read/write position, to set and use the protection mechanism, to change the ownership, to list files in a directory, and to remove a file…
  3. provides a protection mechanism to allow machine users to administer how processes executing on behalf of different users can access the information in files.
  • Three methods of mapping user data to storage blocks are commonly referred to as Contiguous Allocation, Linked Allocation, and Indexed Allocation.

taken from: http://courses.cs.vt.edu/csonline/OS/Lessons/index.html

Leave a Reply

Your email address will not be published. Required fields are marked *