Lecture 2

           O/S Concepts & Structure
                 2.1. Operating system concepts
                 2.2. System calls
                 2.3. Operating system structure




Sistem Operasi          http://fasilkom.narotama.ac.id/
                                                          1
Introduction




                 • A computer system consists of
                   – hardware
                   – system programs
Sistem Operasi     – application programs
                        http://fasilkom.narotama.ac.id/
                                                          2
What is an Operating System

• It is an extended machine
     – Hides the messy details which must be performed
     – Presents user with a virtual machine, easier to use


• It is a resource manager
     – Each program gets time with the resource
     – Each program gets space on the resource

Sistem Operasi       http://fasilkom.narotama.ac.id/
                                                             3
History of Operating Systems (1)




Early batch system
      – bring cards to 1401
      – read cards to tape
      – put tape on 7094 which does computing
      – put tape on 1401 which prints output
Sistem Operasi        http://fasilkom.narotama.ac.id/
                                                        4
History of Operating Systems (2)

• First generation 1945 - 1955
     – vacuum tubes, plug boards
• Second generation 1955 - 1965
     – transistors, batch systems
• Third generation 1965 – 1980
     – ICs and multiprogramming
• Fourth generation 1980 – present
     – personal computers
Sistem Operasi       http://fasilkom.narotama.ac.id/
                                                       5
History of Operating Systems (3)




• Structure of a typical FMS job – 2nd generation
   Sistem Operasi   http://fasilkom.narotama.ac.id/
                                                      6
History of Operating Systems (4)




     • Multiprogramming system
Sistem Operasi
               – three jobs in memory – 3rd generation
                          http://fasilkom.narotama.ac.id/
                                                            7
The Operating System Zoo
•   Mainframe operating systems
•   Server operating systems
•   Multiprocessor operating systems
•   Personal computer operating systems
•   Real-time operating systems
•   Embedded operating systems
•   Smart card operating systems

Sistem Operasi   http://fasilkom.narotama.ac.id/
                                                   8
Computer Hardware Review (1)
                   Monitor




                                                   Bus




• Components of a simple personal computer
Sistem Operasi   http://fasilkom.narotama.ac.id/
                                                         9
Computer Hardware Review (2)




                 (a) A three-stage pipeline
                 (b) A superscalar CPU
Sistem Operasi       http://fasilkom.narotama.ac.id/
                                                       10
Computer Hardware Review (3)




                 • Typical memory hierarchy
Sistem Operasi
                   – numbers shown are rough approximations
                         http://fasilkom.narotama.ac.id/
                                                              11
Computer Hardware Review (4)




                 Structure of a disk drive
Sistem Operasi        http://fasilkom.narotama.ac.id/
                                                        12
Computer Hardware Review (5)




    One base-limit pair and two base-limit pairs
Sistem Operasi    http://fasilkom.narotama.ac.id/
                                                    13
Computer Hardware Review (6)




             (a)                                 (b)


(a) Steps in starting an I/O device and getting interrupt
(b) Sistem Operasi CPU is interrupted
    How the                http://fasilkom.narotama.ac.id/
                                                             14
Computer Hardware Review (7)




             Structure of a large Pentium system
Sistem Operasi         http://fasilkom.narotama.ac.id/
                                                         15
Operating System Concepts (1)




• A process tree
     – A created two child processes, B and C
     – B created three child processes, D, E, and F
Sistem Operasi      http://fasilkom.narotama.ac.id/
                                                      16
Operating System Concepts (2)




(a) A potential deadlock. (b) an actual deadlock.
Sistem Operasi   http://fasilkom.narotama.ac.id/
                                                    17
Operating System Concepts (3)




       File system for a university department
Sistem Operasi      http://fasilkom.narotama.ac.id/
                                                      18
Operating System Concepts (4)




• Before mounting,
     – files on floppy are inaccessible
• After mounting floppy on b,
     – files on floppy are part of file hierarchy
Sistem Operasi          http://fasilkom.narotama.ac.id/
                                                          19
Operating System Concepts (5)




           Two processes connected by a pipe

Sistem Operasi       http://fasilkom.narotama.ac.id/
                                                       20
Steps in Making a System Call




 There are 11 steps in making the system call
Sistem Operasi
                 readhttp://fasilkom.narotama.ac.id/
                       (fd, buffer, nbytes)            21
Some System Calls For Process Management




 Sistem Operasi   http://fasilkom.narotama.ac.id/
                                                    22
Some System Calls For File Management




Sistem Operasi   http://fasilkom.narotama.ac.id/
                                                   23
Some System Calls For Directory Management




  Sistem Operasi   http://fasilkom.narotama.ac.id/
                                                     24
Some System Calls For Miscellaneous Tasks




 Sistem Operasi   http://fasilkom.narotama.ac.id/
                                                    25
System Calls (1)
• A stripped down shell:

while (TRUE) {                                              /* repeat forever */
  type_prompt( );                                           /* display prompt */
  read_command (command, parameters)                        /* input from terminal */

if (fork() != 0) {                                          /* fork off child process */
    /* Parent code */
    waitpid( -1, &status, 0);                               /* wait for child to exit */
} else {
    /* Child code */
    execve (command, parameters, 0);                        /* execute command */
 }
}
 Sistem Operasi           http://fasilkom.narotama.ac.id/
                                                                                           26
System Calls (2)




• Processes have three segments: text, data, stack
  Sistem Operasi  http://fasilkom.narotama.ac.id/
                                                     27
System Calls (3)




(a) Two directories before linking
  /usr/jim/memo to ast's directory

(b) The same directories after linking
Sistem Operasi      http://fasilkom.narotama.ac.id/
                                                      28
System Calls (4)




                 (a) File system before the mount
                 (b) File system after the mount

Sistem Operasi           http://fasilkom.narotama.ac.id/
                                                           29
System Calls (5)




Sistem Operasi   Some Win32 API calls
                    http://fasilkom.narotama.ac.id/
                                                      30
Operating System Structure (1)




Simple structuring model for a monolithic system
 Sistem Operasi   http://fasilkom.narotama.ac.id/
                                                    31
Operating System Structure (2)




        Structure of the THE operating system
Sistem Operasi       http://fasilkom.narotama.ac.id/
                                                       32
Operating System Structure (3)




                 Structure of VM/370 with CMS

Sistem Operasi           http://fasilkom.narotama.ac.id/
                                                           33
Operating System Structure (4)




                 The client-server model
Sistem Operasi          http://fasilkom.narotama.ac.id/
                                                          34
Operating System Structure (5)




The client-server model in a distributed system

Sistem Operasi   http://fasilkom.narotama.ac.id/
                                                   35
Metric Units




                 The metric prefixes

Sistem Operasi      http://fasilkom.narotama.ac.id/
                                                      36

Kcd226 Sistem Operasi Lecture02

  • 1.
    Lecture 2 O/S Concepts & Structure 2.1. Operating system concepts 2.2. System calls 2.3. Operating system structure Sistem Operasi http://fasilkom.narotama.ac.id/ 1
  • 2.
    Introduction • A computer system consists of – hardware – system programs Sistem Operasi – application programs http://fasilkom.narotama.ac.id/ 2
  • 3.
    What is anOperating System • It is an extended machine – Hides the messy details which must be performed – Presents user with a virtual machine, easier to use • It is a resource manager – Each program gets time with the resource – Each program gets space on the resource Sistem Operasi http://fasilkom.narotama.ac.id/ 3
  • 4.
    History of OperatingSystems (1) Early batch system – bring cards to 1401 – read cards to tape – put tape on 7094 which does computing – put tape on 1401 which prints output Sistem Operasi http://fasilkom.narotama.ac.id/ 4
  • 5.
    History of OperatingSystems (2) • First generation 1945 - 1955 – vacuum tubes, plug boards • Second generation 1955 - 1965 – transistors, batch systems • Third generation 1965 – 1980 – ICs and multiprogramming • Fourth generation 1980 – present – personal computers Sistem Operasi http://fasilkom.narotama.ac.id/ 5
  • 6.
    History of OperatingSystems (3) • Structure of a typical FMS job – 2nd generation Sistem Operasi http://fasilkom.narotama.ac.id/ 6
  • 7.
    History of OperatingSystems (4) • Multiprogramming system Sistem Operasi – three jobs in memory – 3rd generation http://fasilkom.narotama.ac.id/ 7
  • 8.
    The Operating SystemZoo • Mainframe operating systems • Server operating systems • Multiprocessor operating systems • Personal computer operating systems • Real-time operating systems • Embedded operating systems • Smart card operating systems Sistem Operasi http://fasilkom.narotama.ac.id/ 8
  • 9.
    Computer Hardware Review(1) Monitor Bus • Components of a simple personal computer Sistem Operasi http://fasilkom.narotama.ac.id/ 9
  • 10.
    Computer Hardware Review(2) (a) A three-stage pipeline (b) A superscalar CPU Sistem Operasi http://fasilkom.narotama.ac.id/ 10
  • 11.
    Computer Hardware Review(3) • Typical memory hierarchy Sistem Operasi – numbers shown are rough approximations http://fasilkom.narotama.ac.id/ 11
  • 12.
    Computer Hardware Review(4) Structure of a disk drive Sistem Operasi http://fasilkom.narotama.ac.id/ 12
  • 13.
    Computer Hardware Review(5) One base-limit pair and two base-limit pairs Sistem Operasi http://fasilkom.narotama.ac.id/ 13
  • 14.
    Computer Hardware Review(6) (a) (b) (a) Steps in starting an I/O device and getting interrupt (b) Sistem Operasi CPU is interrupted How the http://fasilkom.narotama.ac.id/ 14
  • 15.
    Computer Hardware Review(7) Structure of a large Pentium system Sistem Operasi http://fasilkom.narotama.ac.id/ 15
  • 16.
    Operating System Concepts(1) • A process tree – A created two child processes, B and C – B created three child processes, D, E, and F Sistem Operasi http://fasilkom.narotama.ac.id/ 16
  • 17.
    Operating System Concepts(2) (a) A potential deadlock. (b) an actual deadlock. Sistem Operasi http://fasilkom.narotama.ac.id/ 17
  • 18.
    Operating System Concepts(3) File system for a university department Sistem Operasi http://fasilkom.narotama.ac.id/ 18
  • 19.
    Operating System Concepts(4) • Before mounting, – files on floppy are inaccessible • After mounting floppy on b, – files on floppy are part of file hierarchy Sistem Operasi http://fasilkom.narotama.ac.id/ 19
  • 20.
    Operating System Concepts(5) Two processes connected by a pipe Sistem Operasi http://fasilkom.narotama.ac.id/ 20
  • 21.
    Steps in Makinga System Call There are 11 steps in making the system call Sistem Operasi readhttp://fasilkom.narotama.ac.id/ (fd, buffer, nbytes) 21
  • 22.
    Some System CallsFor Process Management Sistem Operasi http://fasilkom.narotama.ac.id/ 22
  • 23.
    Some System CallsFor File Management Sistem Operasi http://fasilkom.narotama.ac.id/ 23
  • 24.
    Some System CallsFor Directory Management Sistem Operasi http://fasilkom.narotama.ac.id/ 24
  • 25.
    Some System CallsFor Miscellaneous Tasks Sistem Operasi http://fasilkom.narotama.ac.id/ 25
  • 26.
    System Calls (1) •A stripped down shell: while (TRUE) { /* repeat forever */ type_prompt( ); /* display prompt */ read_command (command, parameters) /* input from terminal */ if (fork() != 0) { /* fork off child process */ /* Parent code */ waitpid( -1, &status, 0); /* wait for child to exit */ } else { /* Child code */ execve (command, parameters, 0); /* execute command */ } } Sistem Operasi http://fasilkom.narotama.ac.id/ 26
  • 27.
    System Calls (2) •Processes have three segments: text, data, stack Sistem Operasi http://fasilkom.narotama.ac.id/ 27
  • 28.
    System Calls (3) (a)Two directories before linking /usr/jim/memo to ast's directory (b) The same directories after linking Sistem Operasi http://fasilkom.narotama.ac.id/ 28
  • 29.
    System Calls (4) (a) File system before the mount (b) File system after the mount Sistem Operasi http://fasilkom.narotama.ac.id/ 29
  • 30.
    System Calls (5) SistemOperasi Some Win32 API calls http://fasilkom.narotama.ac.id/ 30
  • 31.
    Operating System Structure(1) Simple structuring model for a monolithic system Sistem Operasi http://fasilkom.narotama.ac.id/ 31
  • 32.
    Operating System Structure(2) Structure of the THE operating system Sistem Operasi http://fasilkom.narotama.ac.id/ 32
  • 33.
    Operating System Structure(3) Structure of VM/370 with CMS Sistem Operasi http://fasilkom.narotama.ac.id/ 33
  • 34.
    Operating System Structure(4) The client-server model Sistem Operasi http://fasilkom.narotama.ac.id/ 34
  • 35.
    Operating System Structure(5) The client-server model in a distributed system Sistem Operasi http://fasilkom.narotama.ac.id/ 35
  • 36.
    Metric Units The metric prefixes Sistem Operasi http://fasilkom.narotama.ac.id/ 36