Operating System - LESSON-1
Operating System - LESSON-1
INSTRUCTIONAL MATERIALS
IN
COMP 202833
OPERATING SYSTEM
Approved by:
Welcome to the Polytechnic University of the Philippines. This instructional materials will help you
become an effective learner and successfully meet the requirements of the course. You will
discover that you can learn in a very challenging way at your own pace. You can learn while
enjoying every activities in this course.
Happy learning!
VISION
MISSION
Ensuring inclusive and equitable quality education and promoting lifelong learning
opportunities through a re-engineered polytechnic university by committing to:
continuously develop faculty and employees with the highest level of professionalism
engage public and private institutions and other stakeholders for the attainment of social
development goal
PHILOSOPHY
Education is an instrument for the development of the citizenry and for the enhancement
of nation building; and
That meaningful growth and transmission of the country are best achieved in an
atmosphere of brotherhood, peace, freedom, justice and nationalist-oriented education
imbued with the spirit of humanist internationalism.
2
SUBJECT: COMP 202833 – OPERATING SYSTEM
PREPARED BY: VIRGILIO R. CUAJUNCO, JR., MEM
TEN PILLARS
3
SUBJECT: COMP 202833 – OPERATING SYSTEM
PREPARED BY: VIRGILIO R. CUAJUNCO, JR., MEM
POLYTECHNIC UNIVERSITY OF THE PHILIPPINES
MARAGONDON BRANCH
GOALS
PROGRAM OBJECTIVES
3. To ensure teaching learning efficiency and effectiveness by means of highly qualified and
committed faculty members.
4
SUBJECT: COMP 202833 – OPERATING SYSTEM
PREPARED BY: VIRGILIO R. CUAJUNCO, JR., MEM
COMP 20283
OPERATING SYSTEM
COURSE DESCRIPTION
This course provides an introduction to the concepts, theories and components that serve as the
basis for the design of classical and modern operating systems. Topics include disk
management, process and memory management, file management, deadlocks and system
security and protection. This course discusses and simulates the basic functions of Operating
System.
COURSE OBJECTIVES
5
SUBJECT: COMP 202833 – OPERATING SYSTEM
PREPARED BY: VIRGILIO R. CUAJUNCO, JR., MEM
2.Adeptness in the Apply knowledge through the use of current processor scheduling, disk scheduling and the
Responsible Use of techniques, skills, tools and practices different ways of allocating memory to tasks.
Technology necessary for the IT profession Design and develop a program using concrete
3.Community Understand best practices and standards and function of the operating system such as
Engagement their applications. process scheduling, dik scheduling or memory
4.High Level of Function effectively as a member or leader of management.
Leadership and a development team recognizing the different Analyze the tradeoffs inherent in OS Design.
Organizational roles within a team to accomplish a common Demystify the interactions between the
Skills. goal. programs written and the hardware.
5.Strong Service Develop the role of operating systems in a
Orientation wider context, e.g. extending OS Services via
6.Effective Communicate effectively with the computing system calls.
Communication community and with society at large about Familiarize students with the issues and new
complex computing activities through logical trends involved in the design and
writing, presentations, and clear instructions. implementation of modern operating system.
7.Sense of Nationalism Analyze the local and global impact of Analyze the relationship between the operating
and Global computing information technology on system and the hardware environment in
Responsiveness. individuals, organizations, and society. which it runs.
8.Sense of Personal Understand professional, ethical, legal,
and Professional security and social issues and responsibilities
Ethics in the utilization of information technology.
9.Passion to Life- Recognize the need for and engage in
Long Learning planning self-l;earning and imprroving
performance as a foundation for continuing
professional development.
COURSE REQUIREMENTS
1. Students are encouraged to attend the class sessions (online students) and complete all
the requirements (online and offline students).
2. The course is expected to have a minimum of four (4) quizzes and two (2) major
examination (Midterm and Final Examination).
3. Other requirements such as written outputs, exercises, assignments and the likes will be
given throughout the sessions. These shall be submitted on the due dates set by the
teacher.
GRADING SYSTEM
The grading system will determine if the student passed or failed the course. There will be two
grading periods: Midterm and Final Period. Each period has components of: 70% Class Standing
+ 30% Major Examination. Final Grade will be the average of the two periodical grades.
Midterm Finals
Class Standing 70% Class Standing 70%
6
SUBJECT: COMP 202833 – OPERATING SYSTEM
PREPARED BY: VIRGILIO R. CUAJUNCO, JR., MEM
Quizzes Quizzes
Activities Activities
Asignments Project
Mid-term Examination 30% Assignments
Final Examination 30%
FINAL GRADE = (Midterm + Finals) /2
RUBRICS:
Outstanding Very Good Average Poor
5.0-4.5 4.0-3.0 2.5-1.5 1.0
Completeness Complete in all Complete in some Incomplete in many Incomplete and does
aspects and includes aspects and includes aspects and includes not include
all requirements most of the few requirements requirements
requirements
Analysis and Use Presents an insightful Presents an insightful Presents shallow Presents incomplete
of the and in-depth analysis and analysis of most analysis of data; and analysis of data; and
Entrepreneurial of all data; uses many of the data; uses uses limited fails to use
Concepts and entrepreneurial some entrepreneurial entrepreneurial entrepreneurial
Business Tools concepts and concepts and concepts and concepts and
business tools business tools business tools business tools
learned in the subject learned in the subject learned in the subject learned in the subject
Setting of Presents complete, Presents specific, Presents some Presents limited,
Recommendation realistic, and realistic, and applicable unrealistic
for future action applicable applicable recommendations recommendation from
plans recommendations recommendations from the data the data gathered,
from, and shows how from the data gathered, and shows and failed to show
to use it in their future gathered, and shows how to use it in their how to use it in their
action plans how to use it in their future action plans. future action plans.
future action plans.
Over-all The paper has The paper has clarity, The paper lacks The paper is not clear
cohesiveness sophisticated clarity, conciseness, and clarity, conciseness, and contains serious
(writing and conciseness, and correctness. Includes and correctness. errors. Failed to
presentation) correctness. Includes some needed Includes limited include relevant data
all needed relevant relevant data and relevant data and and analysis.
data and analysis. analysis. analysis.
COURSE GUIDE
7–8 4. Storage Explain buffering and Library Research LCD Projector Recitation
Management describe strategies for Lecture Laptop Computer Seatwork
Disk Scheduling implementing it. Group Discussion Video Tutorials Homework
Concepts Identify the requirements Student’s Self Calculator Written exam
Disk Scheduling for failure recovery. Assessment Disk Scheduling Apps
Algorithms Identify the relationship Problem Solving
between the physical
hardware and the virtual
devices maintained by
the operating system.
Differentiate the
mechanisms used in
interfacing a range of
devices (including
handheld devices,
networks, multimedia) to
a computer and explain
the implications of these
for the design of an
operating system.
Describe the advantages
and disadvantages of
9
SUBJECT: COMP 202833 – OPERATING SYSTEM
PREPARED BY: VIRGILIO R. CUAJUNCO, JR., MEM
direct memory access
and discuss the
circumstances in which
its use is warranted.
Implement a simple
device driver for a range
of possible devices.
Assess the disk
scheduling algorithms
used to calculate the total
head movement and
seek time.
9 Midterm Examination
10 – 11 5. Memory Explain memory Library Research LCD Projector Recitation
Management hierarchy and cost- Individual Laptop Computer Seatwork
Memory performance trade-offs. Assignment Video Tutorials Reserch Work
Management Summarize the principles Simulation Calculator Homework
Concepts of virtual memory as Problem Solving Written exam
Swapping, applied to caching and Lecture
Overlays and paging. Demonstration
Compaction Describe the reason for
Multiprogramming and use of cache
with Fixed and memory.
Variable Partitions Discuss the concept of
Buddy System thrashing, both in terms
of the reasons it occurs
and the techniques used
to recognize and manage
the problem.
Implement the different
memory management
schemes.
Validate the trade-offs in
terms of memory size
and processor speed.
Formulate how the
different memory
management schemes
behave.
Defend the different ways
of allocating memory to
tasks, citing the relative
merits of each.
12 – 13 6. Virtual Memory Calculate the physical Lecture LCD Projector Seatwork
Management and logical addresses Simulation Laptop Computer Homework
Virtual Memory used. Problem Solving Video Tutorials Written Exam
Concepts Evaluate the different task Calculator
Paging, memory management Individual
Segmentation, schemes that can be Assignment
and used. Open Textbook
Segmentation Experiment on the Study
with Paging different algorithms used
Page for page replacement
Replacement Simulate the behavior of
Algorithms page allocation
Page Allocation strategies.
14 – 15 7. Deadlocks Describe how deadlocks Group Report LCD Projector Recitation
10
SUBJECT: COMP 202833 – OPERATING SYSTEM
PREPARED BY: VIRGILIO R. CUAJUNCO, JR., MEM
Deadlock can arise in a system, Reading Laptop Computer Seatwork
Concept and explain the solutions Assignment Video Tutorials Homework
Conditions for available. Class Discussion Written Exam
Deadlock Compare and Contrast Problem Solving
Approaches in the different ways of Simulation
Handling handling deadlock.
Deadlock Simulate and justify if
Deadlock deadlock will or will not
Prevention and occur.
Avoidance
Deadlock
Detection and
Recovery
16 – 17 8. File Management Describe the choices to Reading LCD Projector Research Work
File Concepts be made in designing the Assignment Laptop Computer
and Naming file systems. Library Research Video Tutorials
Logical and Summarize how Open Textbook
Physical View of hardware developments Study
Files have led to changes in
the priorities for the
File Organization
design and the
and Access
management of file
File Attributes systems.
and Operations Compare and contrast
Directories different approaches to
file organization,
recognizing the strengths
and weaknesses of each.
18 Final Examination
REFERENCES
11
SUBJECT: COMP 202833 – OPERATING SYSTEM
PREPARED BY: VIRGILIO R. CUAJUNCO, JR., MEM
TABLE OF CONTENTS
Topic Page
Introduction
Orientation
Lesson 2 Function 10
Unit 1 Processes 10
Unit 2 Process Synchronization 14
Unit 3 Deadlocks 16
Lesson 3 Management 20
Unit 1 Main Memory Management 20
Unit 2 File Management 24
Unit 3 I/O Management 26
12
SUBJECT: COMP 202833 – OPERATING SYSTEM
PREPARED BY: VIRGILIO R. CUAJUNCO, JR., MEM
Lesson 1 Operating System
Unit 1 Fundamentals
Overview:
The operating system is considered as the most important of all system software. This unit
introduces operating systems and their role in the over-all performance of computer systems. An
operating system is software that manages a computer’s hardware. It also provides a basis for
application programs and acts as an intermediary between the computer user and the computer
hardware. An amazing aspect of operating systems is how they vary in accomplishing these
tasks in a wide variety of computing environments. Operating systems are everywhere, from cars
and home appliances that include “Internet of Things” devices, to smart phones, personal
computers, enterprise computers, and cloud computing environments.
Learning Objectives:
1. Describe the general organization of a computer system and the role of interrupts.
2. Describe the components in a modern multiprocessor computer system.
3. Illustrate the transition from user mode to kernel mode.
4. Discuss how operating systems are used in various computing environments.
5. Provide examples of free and open-source operating systems.
Course Materials:
We begin our discussion by looking at the operating system’s role in the overall computer
system. Acomputer system can be divided roughly into four components: the hardware, the
operating system, the application programs, and a user (Figure 1.1).
The hardware—the central processing unit (CPU), the memory, and the input/output (I/O)
devices—provides the basic computing resources for the system. The application
programs—such as word processors, spreadsheets, compilers, and web browsers—define the
ways in which these resources are used to solve users’ computing problems. The operating
system controls the hardware and coordinates its use among the various application programs
for the various users.
We can also view a computer system as consisting of hardware, software, and data. The
operating system provides the means for proper use of these resources in the operation of the
computer system. An operating system is similar to a government. Like a government, it performs
13
SUBJECT: COMP 202833 – OPERATING SYSTEM
PREPARED BY: VIRGILIO R. CUAJUNCO, JR., MEM
no useful function by itself. It simply provides an environment within which other programs can
do useful work.
To understand more fully the operating system’s role, we next explore operating systems from
two viewpoints: that of the user and that of the system.
User View
The user’s view of the computer varies according to the interface being used. Many computer
users sit with a laptop or in front of a PC consisting of a monitor, keyboard, and mouse. Such a
system is designed for one user to monopolize its resources. The goal is to maximize the work
(or play) that the user is performing. In this case, the operating system is designed mostly for
ease of use, with some attention paid to performance and security and none paid to resource
utilization—how various hardware and software resources are shared.
System View
From the computer’s point of view, the operating system is the program most intimately involved
with the hardware. In this context, we can view an operating system as a resource allocator. A
computer system has many resources that may be required to solve a problem: CPU time,
memory space, storage space, I/O devices, and so on. The operating system acts as the
manager of these resources. Facing numerous and possibly conflicting requests for resources,
the operating system must decide how to allocate them to specific programs and users so that it
can operate the computer system efficiently and fairly.
A slightly different view of an operating system emphasizes the need to control the various I/O
devices and user programs. An operating system is acontrol program. A control program
manages the execution of user programs to prevent errors and improper use of the computer. It
is especially concerned with the operation and control of I/O devices.
14
SUBJECT: COMP 202833 – OPERATING SYSTEM
PREPARED BY: VIRGILIO R. CUAJUNCO, JR., MEM
Defining Operating Systems
By now, you can probably see that the term operating system covers many roles and functions.
That is the case, at least in part, because of the myriad designs and uses of computers.
Computers are present within toasters, cars, ships, spacecraft, homes, and businesses. They are
the basis for game machines, cable TV tuners, and industrial control systems.
To explain this diversity, we can turn to the history of computers. Although computers have a
relatively short history, they have evolved rapidly. Computing started as an experiment to
determine what could be done and quickly moved to fixed-purpose systems for military uses,
such as code breaking and trajectory plotting, and governmental uses, such as census
calculation. Those early computers evolved into general-purpose, multifunction mainframes, and
that’s when operating systems were born. In the 1960s, Moore’s Law predicted that the number
of transistors on an integrated circuit would double every 18 months, and that prediction has held
true. Computers gained in functionality and shrank in size, leading to a vast number of uses and
a vast number and variety of operating systems.
• Interrupts are a key way in which hardware interacts with the operating system. A
hardware device triggers an interrupt by sending a signal to the CPU to alert the CPU
that some event requires attention. The interrupt is managed by the interrupt handler.
• For a computer to do its job of executing programs, the programs must be in main
memory, which is the only large storage area that the processor can access directly.
• The main memory is usually a volatile storage device that loses its contents when power
is turned off or lost.
• The most common nonvolatile storage device is a hard disk, which can provide storage
of both programs and data.
• Modern computer architectures are multiprocessor systems in which each CPU contains
several computing cores.
15
SUBJECT: COMP 202833 – OPERATING SYSTEM
PREPARED BY: VIRGILIO R. CUAJUNCO, JR., MEM
• To best utilize the CPU, modern operating systems employ multiprogramming, which
allows several jobs to be in memory at the same time, thus ensuring that the CPU
always has a job to execute.
• To prevent user programs from interfering with the proper operation of the system, the
system hardware has two modes: user mode and kernel mode.
• Various instructions are privileged and can be executed only in kernel mode. Examples
include the instruction to switch to kernel mode, I/O control, timer management, and
interrupt management.
• An operating system manages memory by keeping track of what parts of memory are
being used and by whom. It is also responsible for dynamically allocating and freeing
memory space.
• Storage space is managed by the operating system; this includes providing file systems
for representing files and directories and managing space on mass-storage devices.
• Operating systems provide mechanisms for protecting and securing the operating
system and users. Protection measures control the access of processes or users to the
resources made available by the computer system.
• Data structures that are used in an operating system include lists, stacks, queues, trees,
and maps.
• Free and open-source operating systems are available in source-code format. Free
software is licensed to allow no-cost use, redistribution, and modification. GNU/Linux,
FreeBSD, and Solaris are examples of popular open-source systems.
16
SUBJECT: COMP 202833 – OPERATING SYSTEM
PREPARED BY: VIRGILIO R. CUAJUNCO, JR., MEM
Inserted is a powerpoint presentation
OPERATING SYSTEM
FUNDAMENTAL.pptx
Activities/Assessments:
References:
17
SUBJECT: COMP 202833 – OPERATING SYSTEM
PREPARED BY: VIRGILIO R. CUAJUNCO, JR., MEM
Unit 2 Computer Architecture
Overview:
An operating system provides the environment within which programs are executed. Internally,
operating systems vary greatly in their makeup, since they are organized along many different
lines. The design of a new operating system is a major task. It is important that the goals of the
system be well defined before the design begins. These goals form the basis for choices among
various algorithms and strategies.
We can view an operating system from several vantage points. One view focuses on the services
that the system provides; another, on the interface that it makes available to users and
programmers; a third, on its components and their interconnections. In this chapter, we explore
all three aspects of operating systems, showing the viewpoints of users, programmers, and
operating system designers. We consider what services an operating system provides, how they
are provided, how they are debugged, and what the various methodologies are for designing
such systems. Finally, we describe how operating systems are created and how a computer
starts its operating system.
Learning Objectives:
Course Materials:
Operating systems provide a number of services. At the lowest level, system calls allow a
running program to make requests from the operating system directly. At a higher level, the
command interpreter or shell provides a mechanism for a user to issue a request without writing
a program. Commands may come from files during batch-mode execution or directly from a
terminal when in an interactive or time-shared mode. System programs are provided to satisfy
many common user requests.
The types of requests vary according to level. The system-call level must provide the basic
functions, such as process control and file and device manipulation. Higher-level requests,
satisfied by the command interpreter or system programs, are translated into a sequence of
system calls. System services can be classified into several categories: program control, status
requests, and I/0 requests. Program errors can be considered implicit requests for service.
18
SUBJECT: COMP 202833 – OPERATING SYSTEM
PREPARED BY: VIRGILIO R. CUAJUNCO, JR., MEM
Once the system services are defined, the structure of the operating system can be developed.
Various tables are needed to record the information that defines the state of the computer system
and the status of the system's jobs.
The design of a new operating system is a major task. It is important that the goals of the system
be well defined before the design begins. The type of system desired is the foundation for
choices among various algorithms and strategies that will be needed.
Throughout the entire operating-system design cycle, we must be careful to separate policy
decisions from implementation details (mechanisms). This separation allows maximum flexibility
if policy decisions are to be changed later.
Operating systems are now almost always written in a systems implementation language or in a
higher-level language. This feature improves their implementation, maintenance, and portability.
To create an operating system for a particular machine configuration, we must perform system
generation.
For a computer system to begin running, the CPU must initialize and start executing the
bootstrap program in firmware. The bootstrap can execute the operating system directly if the
operating system is also in the firmware, or it can complete a sequence in which it loads
progressively smarter programs
• The three primary approaches for interacting with an operating system are (1) command
interpreters, (2) graphical user interfaces, and (3) touchscreen interfaces.
• System calls can be divided into six major categories: (1) process control, (2) file
management, (3) device management, (4) information maintenance, (5)
communications, and (6) protection.
• The standard C library provides the system-call interface for UNIX and Linux systems.
• Operating systems also include a collection of system programs that provide utilities to
users.
19
SUBJECT: COMP 202833 – OPERATING SYSTEM
PREPARED BY: VIRGILIO R. CUAJUNCO, JR., MEM
• A linker combines several relocatable object modules into a single binary executable file.
A loader loads the executable file into memory, where it becomes eligible to run on an
available CPU.
• There are several reasons why applications are operating-system specific. These
include different binary formats for program executables, different instruction sets for
different CPUs, and system calls that vary from one operating system to another.
• An operating system is designed with specific goals in mind. These goals ultimately
determine the operating system’s policies. An operating system implements these
policies through specific mechanisms.
• A layered operating system is divided into a number of discrete layers, where the bottom
layer is the hardware interface and the highest layer is the user interface. Although
layered software systems have had some success, this approach is generally not ideal
for designing operating systems due to performance problems.
• The microkernel approach for designing operating systems uses a minimal kernel; most
services run as user-level applications. Communication takes place via message
passing.
• A boot loader loads an operating system into memory, performs initialization, and begins
system execution.
COMPUTER
ARCHITECTURE.pptx
20
SUBJECT: COMP 202833 – OPERATING SYSTEM
PREPARED BY: VIRGILIO R. CUAJUNCO, JR., MEM
Activities/Assessments:
References:
21
SUBJECT: COMP 202833 – OPERATING SYSTEM
PREPARED BY: VIRGILIO R. CUAJUNCO, JR., MEM
References:
22
SUBJECT: COMP 202833 – OPERATING SYSTEM
PREPARED BY: VIRGILIO R. CUAJUNCO, JR., MEM