CS 334: Principles of Operating
System
         An Introduction
                          Course Information
Course Name:         Principles of Operating Systems
Course Code:         CS 334
Course Type:         Core, 12 credits
Course Description: This course is tailored to develop an understanding of operating
                    system core concepts.
Mode of Delivery:    2 hours lecture, 1 hour practical per week.
Lecture Session:     Tuesday 1600 hrs, room B302
Practical Session:   Tuesday 0800 hrs, room D01
Course Instructor:   Anthony Kigombola, A107, kigombola@gmail.com
Course Assistant:    Henry Mkama,
Prerequisites: CS 151: Computer Organization and Architecture I and
               CS 252: Computer Organization and Architecture II
                                    Course Outline
Lecture 1: Introduction
       Course Information
       Introduction to Operating Systems
Lecture 2: Process management
       Process Life cycle
       Process Scheduling
       Process Synchronization
       Threads and Multithreading
Lecture 3: Memory management
       Memory Allocation
       Paging
       Segmentation
       Virtual Memory
                              Course Outline
Lecture 4: File Management
Lecture 5: I/O management
Lecture 6: Deadlocks
Lecture 7: Security and Control
Lecture 8: OS Design
Practical
P1 Investigating Deadlocks
P2 Process States and Memory Management
P3 Process Synchronization
P4 Process Scheduling
P5 Memory Management
Case Studies
                   Assessment
 Week        Assessments         Marks
   6      Test 1                 15%
  12      Test 2                 15%
 3 - 12   Practicals/Use Cases   10%
16 or 17 Final Exam              60%
                   Textbooks/References
1. Modern Operating System, 4th edition, by Tannenbaum, A.S.,
   Prentice-Hall
2. Operating System Concepts, 10th edition , by Silberschatz, A.,
   Galvan,B. P., & Gagne, G.
3. Principles of Operating System, by Naresh Chauhan, Oxford
   University Press
           Introduction to Operating System
By the end of this lecture, you will have gained knowledge of the
following topics.
i. Operating System Overview
ii. History of Operating Systems
iii. Types of Operating Systems
iv. General Concepts on Operating Systems
      Introduction to Operating Systems
• There was a time in the history of computers when user
  programs were operating directly on the machine.
• Given the complexity of the machine, it was very
  cumbersome to write a computer program that, apart
  from solving a business process, it should also manage
  the processor, memory, disk, mouse, keyboard and
  display.
• Therefore, a software was designed, which worked on
  the hardware to relieve applications and programmers
  from the machine view of the system.
• The software did all the functionalities that needed to be
  performed on the hardware, on behalf of the user.
• This software that operates the computer system is
  known as an Operating System (OS)
      Introduction to Operating System
• An Operating System (OS) is a software layer that sits
  between user programs and computer hardware. OS
  abstracts hardware resources and provides to application
  programs a clean view of the resources.
       Introduction to Operating System
OS functions can be summarized into two main functions
1. Computer Hardware Abstraction. The architecture
    (instruction set, memory organization, I/O, and bus
    structure) of most computers at the machine-language
    level is primitive and complex. Abstraction hides all this
    complexity and presents to users and application
    programs a neat and friendly environment to work in.
2. Computer Resource Management. Another main
   function of the operating system is to provide an
   orderly and controlled allocation of the processors,
   memories, and I/O devices among the various programs
   wanting to use them.
         History of Operating Systems
1. As OS are closely tied to the underlying computer
   architecture, the changes in computer architecture
   have had an impact on the design of OS.
2. We trace the history of OS based on the generations of
   computers
                                    Generations of Computers
                          Generation     Period           Technology
                          1st Gen        1945 -1955       Vacuum Tube
                          2nd Gen        1955 - 1965      Transistor
                          3rd Gen        1975 - 1980      Integrated Circuits
                          4th Gen        1980 - Present   Microprocessors
                          5th Gen        1990 - Present   Mobile Computing
         History of Operating Systems
The First Generation (1945 – 1955)
• Computers in this generation were based on vacuum
  tubes e.g. Z3 built by Konrad Zuse, ENIAC by William
  Mauchley, Colossus by Alan Turing and Mark 1 built by
  Howard Aiken.
• All programming was done in machine language by
  wiring up electrical circuits using cables and plugboard
• There were no Operating Systems no programming
  languages
          History of Operating Systems
The Second Generation (1955 – 1965)
• With the introduction of transistors in the 1950s, computers
  were transformed, resulting in the development of more
  robust machines called mainframes.
• Programming was done on paper e.g. using FORTRAN and
  punched into cards before being loaded onto computers with
  a card reader
• Operating systems were introduced in this generation e.g.
  IBSYS and FORTRAN Monitor System (FMS)
• Batch computing was also introduced to increase the
  efficiency of the computing system
         History of Operating Systems
The Third Generation (1965 – 1980)
• The introduction of Integrated Circuits (ICs) introduced a
  huge price-performance advantage.
• With ICs it was possible to manufacture mid-sized
  machines (called Minicomputers) which could perform
  both complex scientific calculations and everyday
  commercial calculations e.g. IBM 360
• Several new ideas were introduced in the OS including
   i. Multiprogramming, the ability to run several
        programs at the same time using memory partition
   ii. Spooling, the ability to read program cards into disk
        directly, and
   iii. Time-sharing, a variant of multiprogramming in
        which more than one user can access and use the
        system at the same time
• Examples OS/360, MULTICS, UNIX
         History of Operating Systems
The Fourth Generation (1980 – Present)
• The introduction of Large Scale Integrated Circuits and
  Very Large Scale Integrated Circuits started a new wave
  of computer technologies called Microcomputers or
  Personal Computers (PCs)
• At the time, the computing industry was well developed
  with distinct specializations such as processor
  manufacturers (Intel) computer manufacturers (IBM,
  Apple) and applications developers (Microsoft)
• Early operating systems include CP/M, DOS, MS-DOS,
  and Lisa
• Current popular OS includes Windows, Mac OS, Linux,
  Unix, and FreeBSD
         History of Operating Systems
The Fifth Generation (1990 – Present)
• Mobile computing stems from the idea of combining
  telephony and computing into one phone-like device
  popularly known as a smartphone
• Symbian OS was used in the first smartphones
   i. 1996 Nokia N9000
   ii. 1997 Ericsson GS88 Penelope
• RIM OS released with Blackberry in 2002
• iOS released with iPhone in 2007
• Android released by Google in 2008
           Types of Operating Systems
i.   Batch Systems. More than one job can be stored in
     main memory, e.g. Fortran Monitor System (FMS)
ii. Multiuser Systems. Jobs of different users who are
    connected to a main computer are executed through
    multiprogramming. Interaction of jobs with the user is
    possible e.g. MULTICS, UNIX
iii. Multitasking systems. Multiple tasks of a single user
     can be opened on the system through multi-
     programming, e.g Windows
iv. Network systems. A user can connect to another
    machine and execute tasks, e.g. Novell Netware,
    Windows NT
          Types of Operating Systems
v. Distributed Systems. Multiple nodes on a network can
work as one powerful machine, e.g. Amoeba, V system,
Chorus
vi. Real-Time Systems. Used to handle time-bound
responses to the applications, e.g. pSOS, VxWorks, RTLinux
vii. Embedded systems. Specialized systems with small size,
memory and power restrictions, e.g. Toshiba Pocket PC,
Palm OS, Symbian OS, iPhone OS, RIM’s BlackBerry,
Windows Phone, Linux, Android and Maemo.
          Operating Systems Concepts
Most operating systems contain common and basic
concepts discussed in this section
1. A process. A process is a program in execution. A
   process is associated with an address space, registers,
   open files and other related process
2. Address Space. An address space is a list of memory
   locations which a process is allowed to access. The
   address is a 32/64-bit number starting from 0 to a
   maximum.
3. A file. An abstraction of data stored in disk
4. Input/Output. OS manages the input and output
   devices using I/O subsystems consisting of device
   drivers
          Operating Systems Concepts
5. Permission. Files access is protected using permission
assigned as a protection code to each file (The 9 bit rwx
code)
6. Shell. User interface to the Operating System. Can be
command-line or GUI based. Provides a friendly way to
submit computing requests to the OS and get responses.
7. System Call. A system call is a mechanism used by
programs to request services from the operating system
(OS). A system call is initiated by the program executing a
specific instruction, which triggers a switch to kernel mode,
allowing the program to request a service from the OS. The
OS then handles the request, performs the necessary
operations, and returns the result back to the program.
                     Class Work
1. What are the main functions of an operating system?
2. Discuss the history of operating systems based on
   associated computer generations
3. How does UNIX differ from its predecessor MULTICS?
4. Trace back the rise of Windows as the most popular OS
5. How many lines of code does an operating system such
   as Windows or Linux contain?
6. Think of an interesting OS project that you would like to
   accomplish this semester