Chapter 1 : Introduction to Operating System Concepts. Meenal K Jabde Modern College of Arts, Science & Commerce Ganeshkhind, Pune 16
Contents 1.Introduction to Operating System Concept. 2. Different services provided by Operating System to User. 3. Introduce the concept of Process, Process States, Process Control Block, User Interface, System Calls.
What is Operating System?  An operating system is a program that controls the execution of application programs and acts as an interface between the user of a computer and the computer hardware.  A more common definition is that the operating system is the one program running at all times on the computer (usually called the kernel), with all else being application programs.
Functions of Operating system – Operating system performs three functions: • Convenience: An OS makes a computer more convenient to use. • Efficiency: An OS allows the computer system resources to be used efficiently. • Ability to Evolve: An OS should be constructed in such a way as to permit the effective development, testing, and introduction of new system functions at the same time without interfering with service.
The operating system as User Interface – User System and application programs Operating system Hardware
Conceptual view of a computer system
OS is designed to serve two basic purposes  It controls the allocation and use of the computing System’s resources among the various user and tasks.  It provides an interface between the computer hardware and the programmer that simplifies and makes it feasible for coding, creation, debugging of application programs.
The Operating system must support the following tasks. The task are: Provides the facilities to create, modification of programs and data files using an editor. Access to the compiler for translating the user program from high-level language to machine language. Provide a loader program to move the compiled program code to the computer’s memory for execution. Provide routines that handle the details of I/O programming
History of Operating system Generation Year Electronic device used Types of OS Device First 1945-55 Vacuum Tubes Plug Boards Second 1955-65 Transistors Batch Systems Third 1965-80 Integrated Circuits(IC) Multiprogramming Fourth Since 1980 Large Scale Integration PC
Types of Operating Systems An Operating System performs all the basic tasks like managing files, processes, and memory. Thus operating system acts as the manager of all the resources, i.e., resource manager. Thus, the operating system becomes an interface between user and machine. Some widely used operating systems are as follows- Batch Operating System- Sequence of jobs in a program on a computer without manual interventions. Time-sharing operating System- allows many users to share the computer resources. (Max utilization of the resources). Distributed operating System- Manages a group of different computers and makes appear to be a single computer. Network operating system- computers running in different operating systems can participate in a common network (It is used for security purposes). Real-time operating system – meant applications to fix the deadlines.
1. Batch Operating System – This type of operating system does not interact with the computer directly. There is an operator which takes similar jobs having the same requirement and group them into batches. It is the responsibility of the operator to sort jobs with similar needs
2. Time-Sharing Operating Systems – Each task is given some time to execute so that all the tasks work smoothly. Each user gets the time of CPU as they use a single system. These systems are also known as Multitasking Systems. The task can be from a single user or different users also. The time that each task gets to execute is called quantum. After this time interval is over OS switches over to the next task.
3. Distributed Operating System – These types of the operating system is a recent advancement in the world of computer technology and are being widely accepted all over the world and, that too, with a great pace. Various autonomous interconnected computers communicate with each other using a shared communication network. Independent systems possess their own memory unit and CPU.
4. Network Operating System –  These systems run on a server and provide the capability to manage data, users, groups, security, applications, and other networking functions. These types of operating systems allow shared access of files, printers, security, applications, and other networking functions over a small private network.
5. Real-Time Operating System –  These types of OSs serve real-time systems. The time interval required to process and respond to inputs is very small. This time interval is called response time.  Real-time systems are used when there are time requirements that are very strict like missile systems, air traffic control systems, robots, etc.
Two types of Real-Time Operating System which are as follows:  Hard Real-Time Systems: These OSs are meant for applications where time constraints are very strict and even the shortest possible delay is not acceptable. These systems are built for saving life like automatic parachutes or airbags which are required to be readily available in case of any accident. Virtual memory is rarely found in these systems.  Soft Real-Time Systems: These OSs are for applications where for time- constraint is less strict.
A list of common services offered by an almost all operating systems: User Interface Program Execution File system manipulation Input / Output Operations Communication Resource Allocation Error Detection Accounting Security and protection
Process  A process is a program in execution. For example, when we write a program in C or C++ and compile it, the compiler creates binary code. The original code and binary code are both programs. When we run the binary code, it becomes a process.  A process is an ‘active’ entity, as opposed to a program, which is a ‘passive’ entity. A single program can create many processes when run multiple times; for example, when we open a .exe or binary file multiple times, multiple instances begin (multiple processes are created).
What does a process look like in memory?  Text Section: A Process, sometimes known as the Text Section, also includes the current activity represented by the value of the Program Counter.  Stack: The stack contains the temporary data, such as function parameters, returns addresses, and local variables.  Data Section: Contains the global variable.  Heap Section: Dynamically allocated memory to process during its run time.
Attributes or Characteristics of a Process  1. Process Id: A unique identifier assigned by the operating system  2. Process State: Can be ready, running, etc.  3. CPU registers: Like the Program Counter (CPU registers must be saved and restored when a process is swapped in and out of CPU)  4. Account's information:  5. I/O status information: For example, devices allocated to the process, open files, etc  6. CPU scheduling information: For example, Priority (Different processes may have different priorities, for example a short process may be assigned a low priority in the shortest job first scheduling)
Process Life Cycle/States of Process  1. New: Newly Created Process (or) being-created process.  2. Ready: After creation process moves to Ready state, i.e. the process is ready for execution.  3. Run: Currently running process in CPU (only one process a time can be under execution in a single processor).  4. Wait (or Block): When a process requests I/O access.  5. Complete (or Terminated): The process completed its execution.  6. Suspended Ready: When the ready queue becomes full, some processes are moved to suspended ready state  7. Suspended Block: When waiting queue becomes full.
Process Control Block  A Process Control Block is a data structure maintained by the Operating System for every process. The PCB is identified by an integer process ID (PID). A PCB keeps all the information needed to keep track of a process as listed below in the table.  While creating a process the operating system performs several operations. To identify the processes, it assigns a process identification number (PID) to each process. As the operating system supports multi-programming, it needs to keep track of all the processes. For this task, the process control block (PCB) is used to track the process’s execution status.
1. Pointer – It is a stack pointer which is required to be saved when the process is switched from one state to another to retain the current position of the process. 2. Process state – It stores the respective state of the process. 3. Process number – Every process is assigned with a unique id known as process ID or PID which stores the process identifier. 4. Program counter – It stores the counter which contains the address of the next instruction that is to be executed for the process. 5. Register – These are the CPU registers which includes: accumulator, base, registers and general-purpose registers. 6. Memory limits – This field contains the information about memory management system used by operating system. This may include the page tables, segment tables etc. 7. Open files list – This information includes the list of files opened for a process. 8. Miscellaneous accounting and status data – This field includes information about the amount of CPU used, time constraints, jobs or process number, etc.
What are system calls in Operating System?  The interface between a process and an operating system is provided by system calls. In general, system calls are available as assembly language instructions. They are also included in the manuals used by the assembly level programmers. System calls are usually made when a process in user mode requires access to a resource. Then it requests the kernel to provide the resource via a system call.
Types of System Calls There are mainly five types of system calls. Process Control These system calls deal with processes such as process creation, process termination etc. File Management These system calls are responsible for file manipulation such as creating a file, reading a file, writing into a file etc. Device Management These system calls are responsible for device manipulation such as reading from device buffers, writing into device buffers etc. Information Maintenance These system calls handle information and its transfer between the operating system and the user program. Communication These system calls are useful for interprocess communication. They also deal with creating and deleting a communication connection.
Types of System Calls Windows Linux Process Control CreateProcess() ExitProcess() WaitForSingleObject() fork() exit() wait() File Management CreateFile() ReadFile() WriteFile() CloseHandle() open() read() write() close() Device Management SetConsoleMode() ReadConsole() WriteConsole() ioctl() read() write() Information Maintenance GetCurrentProcessID() SetTimer() Sleep() getpid() alarm() sleep() Communication CreatePipe() CreateFileMapping() MapViewOfFile() pipe() shmget() mmap()
Thank you

Chapter 1 Introduction to Operating System Concepts

  • 1.
    Chapter 1 : Introductionto Operating System Concepts. Meenal K Jabde Modern College of Arts, Science & Commerce Ganeshkhind, Pune 16
  • 2.
    Contents 1.Introduction to OperatingSystem Concept. 2. Different services provided by Operating System to User. 3. Introduce the concept of Process, Process States, Process Control Block, User Interface, System Calls.
  • 3.
    What is OperatingSystem?  An operating system is a program that controls the execution of application programs and acts as an interface between the user of a computer and the computer hardware.  A more common definition is that the operating system is the one program running at all times on the computer (usually called the kernel), with all else being application programs.
  • 4.
    Functions of Operatingsystem – Operating system performs three functions: • Convenience: An OS makes a computer more convenient to use. • Efficiency: An OS allows the computer system resources to be used efficiently. • Ability to Evolve: An OS should be constructed in such a way as to permit the effective development, testing, and introduction of new system functions at the same time without interfering with service.
  • 5.
    The operating systemas User Interface – User System and application programs Operating system Hardware
  • 6.
    Conceptual view ofa computer system
  • 7.
    OS is designed toserve two basic purposes  It controls the allocation and use of the computing System’s resources among the various user and tasks.  It provides an interface between the computer hardware and the programmer that simplifies and makes it feasible for coding, creation, debugging of application programs.
  • 8.
    The Operating systemmust support the following tasks. The task are: Provides the facilities to create, modification of programs and data files using an editor. Access to the compiler for translating the user program from high-level language to machine language. Provide a loader program to move the compiled program code to the computer’s memory for execution. Provide routines that handle the details of I/O programming
  • 9.
    History of Operatingsystem Generation Year Electronic device used Types of OS Device First 1945-55 Vacuum Tubes Plug Boards Second 1955-65 Transistors Batch Systems Third 1965-80 Integrated Circuits(IC) Multiprogramming Fourth Since 1980 Large Scale Integration PC
  • 10.
    Types of Operating Systems An OperatingSystem performs all the basic tasks like managing files, processes, and memory. Thus operating system acts as the manager of all the resources, i.e., resource manager. Thus, the operating system becomes an interface between user and machine. Some widely used operating systems are as follows- Batch Operating System- Sequence of jobs in a program on a computer without manual interventions. Time-sharing operating System- allows many users to share the computer resources. (Max utilization of the resources). Distributed operating System- Manages a group of different computers and makes appear to be a single computer. Network operating system- computers running in different operating systems can participate in a common network (It is used for security purposes). Real-time operating system – meant applications to fix the deadlines.
  • 11.
    1. Batch OperatingSystem – This type of operating system does not interact with the computer directly. There is an operator which takes similar jobs having the same requirement and group them into batches. It is the responsibility of the operator to sort jobs with similar needs
  • 12.
    2. Time-Sharing OperatingSystems – Each task is given some time to execute so that all the tasks work smoothly. Each user gets the time of CPU as they use a single system. These systems are also known as Multitasking Systems. The task can be from a single user or different users also. The time that each task gets to execute is called quantum. After this time interval is over OS switches over to the next task.
  • 13.
    3. Distributed OperatingSystem – These types of the operating system is a recent advancement in the world of computer technology and are being widely accepted all over the world and, that too, with a great pace. Various autonomous interconnected computers communicate with each other using a shared communication network. Independent systems possess their own memory unit and CPU.
  • 14.
    4. Network OperatingSystem –  These systems run on a server and provide the capability to manage data, users, groups, security, applications, and other networking functions. These types of operating systems allow shared access of files, printers, security, applications, and other networking functions over a small private network.
  • 15.
    5. Real-Time OperatingSystem –  These types of OSs serve real-time systems. The time interval required to process and respond to inputs is very small. This time interval is called response time.  Real-time systems are used when there are time requirements that are very strict like missile systems, air traffic control systems, robots, etc.
  • 16.
    Two types ofReal-Time Operating System which are as follows:  Hard Real-Time Systems: These OSs are meant for applications where time constraints are very strict and even the shortest possible delay is not acceptable. These systems are built for saving life like automatic parachutes or airbags which are required to be readily available in case of any accident. Virtual memory is rarely found in these systems.  Soft Real-Time Systems: These OSs are for applications where for time- constraint is less strict.
  • 17.
    A list ofcommon services offered by an almost all operating systems: User Interface Program Execution File system manipulation Input / Output Operations Communication Resource Allocation Error Detection Accounting Security and protection
  • 18.
    Process  A processis a program in execution. For example, when we write a program in C or C++ and compile it, the compiler creates binary code. The original code and binary code are both programs. When we run the binary code, it becomes a process.  A process is an ‘active’ entity, as opposed to a program, which is a ‘passive’ entity. A single program can create many processes when run multiple times; for example, when we open a .exe or binary file multiple times, multiple instances begin (multiple processes are created).
  • 19.
    What does aprocess look like in memory?  Text Section: A Process, sometimes known as the Text Section, also includes the current activity represented by the value of the Program Counter.  Stack: The stack contains the temporary data, such as function parameters, returns addresses, and local variables.  Data Section: Contains the global variable.  Heap Section: Dynamically allocated memory to process during its run time.
  • 20.
    Attributes or Characteristicsof a Process  1. Process Id: A unique identifier assigned by the operating system  2. Process State: Can be ready, running, etc.  3. CPU registers: Like the Program Counter (CPU registers must be saved and restored when a process is swapped in and out of CPU)  4. Account's information:  5. I/O status information: For example, devices allocated to the process, open files, etc  6. CPU scheduling information: For example, Priority (Different processes may have different priorities, for example a short process may be assigned a low priority in the shortest job first scheduling)
  • 21.
    Process Life Cycle/Statesof Process  1. New: Newly Created Process (or) being-created process.  2. Ready: After creation process moves to Ready state, i.e. the process is ready for execution.  3. Run: Currently running process in CPU (only one process a time can be under execution in a single processor).  4. Wait (or Block): When a process requests I/O access.  5. Complete (or Terminated): The process completed its execution.  6. Suspended Ready: When the ready queue becomes full, some processes are moved to suspended ready state  7. Suspended Block: When waiting queue becomes full.
  • 22.
    Process Control Block A Process Control Block is a data structure maintained by the Operating System for every process. The PCB is identified by an integer process ID (PID). A PCB keeps all the information needed to keep track of a process as listed below in the table.  While creating a process the operating system performs several operations. To identify the processes, it assigns a process identification number (PID) to each process. As the operating system supports multi-programming, it needs to keep track of all the processes. For this task, the process control block (PCB) is used to track the process’s execution status.
  • 23.
    1. Pointer –It is a stack pointer which is required to be saved when the process is switched from one state to another to retain the current position of the process. 2. Process state – It stores the respective state of the process. 3. Process number – Every process is assigned with a unique id known as process ID or PID which stores the process identifier. 4. Program counter – It stores the counter which contains the address of the next instruction that is to be executed for the process. 5. Register – These are the CPU registers which includes: accumulator, base, registers and general-purpose registers. 6. Memory limits – This field contains the information about memory management system used by operating system. This may include the page tables, segment tables etc. 7. Open files list – This information includes the list of files opened for a process. 8. Miscellaneous accounting and status data – This field includes information about the amount of CPU used, time constraints, jobs or process number, etc.
  • 24.
    What are systemcalls in Operating System?  The interface between a process and an operating system is provided by system calls. In general, system calls are available as assembly language instructions. They are also included in the manuals used by the assembly level programmers. System calls are usually made when a process in user mode requires access to a resource. Then it requests the kernel to provide the resource via a system call.
  • 25.
    Types of SystemCalls There are mainly five types of system calls. Process Control These system calls deal with processes such as process creation, process termination etc. File Management These system calls are responsible for file manipulation such as creating a file, reading a file, writing into a file etc. Device Management These system calls are responsible for device manipulation such as reading from device buffers, writing into device buffers etc. Information Maintenance These system calls handle information and its transfer between the operating system and the user program. Communication These system calls are useful for interprocess communication. They also deal with creating and deleting a communication connection.
  • 26.
    Types of SystemCalls Windows Linux Process Control CreateProcess() ExitProcess() WaitForSingleObject() fork() exit() wait() File Management CreateFile() ReadFile() WriteFile() CloseHandle() open() read() write() close() Device Management SetConsoleMode() ReadConsole() WriteConsole() ioctl() read() write() Information Maintenance GetCurrentProcessID() SetTimer() Sleep() getpid() alarm() sleep() Communication CreatePipe() CreateFileMapping() MapViewOfFile() pipe() shmget() mmap()
  • 27.