Sunteți pe pagina 1din 49

Operating System

Maryam S.Kom, M.Eng.


Prodi Informatika
Fakultas Ilmu Komunikasi dan Informatika
Universitas Muhammadiyah Surakarta
How to get the most of the course
 Read ahead and use lectures to ask questions

 Take notes

 Do the coursework well. Straightforward - schedule smartly

 Exam questions are a mix of simple conceptual and


challenging applied ones

 If you are struggling, ask earlier rather than later

 If you don’t understand – ask!


Course Aims
 Understanding the concepts that
underlie OS

 Purpose, structure and functions of OS

 Illustration of key OS aspects by


example
Course Outcomes
 By the end of the course you should be able to
 Describe, contrast and compare differing

structures for OSes


 Understand and analyse theory and

implementation of: processes, resource control


(concurrency etc.), physical and virtual memory,
scheduling, I/O and files
Course Structure
 Introduction: overview of OS
 Basic OS functions
 Process management: scheduling, concurrency
 Scheduling: CPU utilization and task scheduling
 Concurrency: mutual exclusion, synchronization, deadlock,
starvation, etc.
 Memory management
 Physical memory, early paging and segmentation techniques
 Modern virtual memory concepts and techniques
 Paging policies
 Storage Management
 Low level I/O functions, high level I/O functions and filesystems
 Other topics to be determined, e.g virtualisation, security
Administrative Details
 Prodi : Informatics
 SKS : 3 SKS
 When and Where : (Semester 3)
 Monday, 12:30-15:00
 Form a lecturer :
 discourse
 discussion
 Description
 Discussed about the technology used in the operating
system, component, and its aplication.
Assessment
 5% precision
 30% assignment
 30% mid exam
 35% EXAM
77 ≤ 𝑁 ≤ 100 = A
70 ≤ 𝑁 ≤ 76.99 = AB
63 ≤ 𝑁 ≤ 69.99 = B
56 ≤ 𝑁 ≤ 62.99 = BC
50 ≤ 𝑁 ≤ 55.99 = C
35 ≤ 𝑁 ≤ 49.99 = D
0 ≤ 𝑁 ≤ 34.99 = E
Reference
 William Stallings.
2012. Operating
Systems Internals
and Design
Principles. Prentice
Hall. New York.
Contract’s course
 Students who do not attend more than 4 times
cannot join exam
 Students who do not attend one of them exam or
exam with a valid permit may still pass by taking a
repair examination with a maximum value of B.
 Students who have score an E or D are MUST take
a repair test with a maximum score of B.
 15 minutes of delay tolerance.
TOPIC
 Introduction of Operating System
 Structure of Operating System
 Process Management
 Memory Management
 Mid exam
 Memory Management
 Storagen Management
 I/O File
 EXAM
Computer System
Motivation (1) : Facebook

1.23 billion users


Requires :
-Scheduling
-Inter Process Communication
-Storage
-Concurrency
-Etc.

180,000 Linux servers


Motivation (2) : Moore’s Law

Moore’s Law

2X transistors/Chip Every 1.5 years


Gordon Moore (co-founder of Called “Moore’s Law”
Intel) predicted in 1965 that the
transistor density of Microprocessors have
semiconductor chips would become smaller, denser,
double roughly every 18 months. and more powerful.
Motivation (3) : Dramatic change
Computers
Per Person Number
crunching, Data
1:106 Storage,
Mainframe Massive
Services,
Mini Mining
1:103
Workstation
Productivity,
PC
Interactive
Laptop
1:1
PDA
Cell
Streaming
from/to the
103:1 physical world

years
The Internet of
Bell’s Law: new computer class per 10 years Things!
Motivation (4) : Computing Devices
Everywhere
Motivation (5)
 (Anti)Virus
 System call, memory management
 Game Development
 Thread, memory management
 Smartphone
 Sistem I/O, schedulling
 Cloud computing
 Virtual machine
Computer component
 Hardware
 Storage

 RAM, Magnetic disk, SSD

 I/O

 Keyboard, mouse, monitor

 Software
 Operating System

 e.x. Linux, Windows, MacOS

 System dan Application Program

 e.x. Database, text editor

 Brawinware (User)
 People, Machines, other computers
Static View of System
Components
What Operating Systems Do
 Depends on the point of view.
 Users want convenience, ease of use and good performance
 Don’t care about resource utilization.

 But a shared computer such as mainframe or minicomputer


must keep all users happy.
 Users of dedicate systems such as workstations have
dedicated resources but frequently use shared resources
from servers.
 Handheld computers are resource poor, optimized for
usability and battery life.
 Some computers have little or no user interface, such as
embedded computers in devices and automobiles
User view of Computer Systems

Applications
e.g. Word, Netscape, etc

Operating System –
- the user interface

Software that
controls the
hardware devices
How Programs Are Run
 The operating system presents an interface to the user
(e.g. Windows Desktop)
 The user double clicks on an icon to run a program (e.g.
Microsoft Word)
 The operating system copies the program (or at least the first part
of it) from the hard disk into main memory
 The CPU runs the instructions in the program, and presents the
initial Word screen
 Within Word, the user uses the menu to open a document
 The application software (Word) asks the Operating System to
open the file.
 The Operating System communicates with the hardware to open
the file on the hard disk.
Definition and Role of
Operating System
 OS as Resource allocator
 Regulates and allocates resources
 e.x. process management, memory
management
 OS as control program
 OS perform execution control of user
program and I/O
 OS as Kernel
 Programs that run all of the time
Organization of Computer System
Organization of a
Computer System
 Processor (CPU) Storage I/O Device
 Main Memory
 Secondary
Storage
 Input Devices
 Output Devices
The Processor
 The processor is the "brain" of the computer system.
 Main processor is called the Central Processing Unit (CPU).
 A particular computer will have a particular type of
processor, such as a Pentium or a SPARC chip.
 Co-processors assist the CPU with some of the processing
functions. Examples:
 Math co-processors handle heavy duty math processing
 Graphics coprocessors speed up the display of graphics
onto the monitor
Central Processing Unit (CPU)

Performs calculations
Arithmetic / Logic Unit
and decisions

Coordinates
Control Unit processing steps

Small, fast
Registers storage areas for
instructions and
data
Register Processor
• Accessing memory to retrieve
instructions requires more time than
running it - resolved by registering on
the processor
• To store the main variables and
temporary results - as a processing
place
Register ..
• Program counter - contains the memory
address of the next instruction to be taken
• Stack pointer - a pointer that shows the top
of a stack in memory
• Word status program - saves the status /
state of the program that the processor
Memory
Computer Memory -
millions/billions of on/off charges

Divided into:

 Bits 0 or 1

 Bytes Groups of 8 bits


A byte is the smallest unit of storage.
(Can hold one text character)

 Words Groups of bits/bytes (8, 16, 32, 64-bits)

It consist of : Main Memory,

Secondary Storage
CPU and Memory
 CPU can interact with main memory in two ways:
 It can write a byte/word to a given memory location.
 Theprevious bits that were in that location are
destroyed
 The new bits are saved for future use.
 It can read a byte/word from a given memory location.
 The CPU copies the bits stored at that location and
stores them in a CPU register
 Thecontents of the memory location are NOT
changed.
Main Memory Characteristics
 Very closely connected to the CPU.
 Contents are quickly and easily changed
 Why? Akses CPU ke main memory hanya butuh beberapa
clock

 Holds the programs and data that the processor is


actively working with.
 Interacts with the processor millions of times per
second.
 Nothing permanent is kept in main memory.
Secondary Memory
Characteristics
 Connected to main memory through a bus and a device
controller.
 Contents are easily changed, but access is very slow
compared to main memory.
 Why? Akses lambat karena butuh seek data

 Used for long-term storage of programs and data, ex : E.x.


flash drive, magnetic disc, optical disc, magnetic tape
 Much larger than main memory (GBs vs. MBs).
Contoh Main Memory : Register
• Volatile
• Contains data that will be processed
directly on the processor
• Very high speed.
• Limited capacity
• As a place to calculate / compute data
Cache Memory
• Volatile
• Increase the speed of retrieving and storing data in
memory by the processor
• If the program requires data in memory, the cache
checks whether it exists, if there is a cache hit, if it
doesn't exist it will search for RAM, with the
consequence that the time needed is longer
• Some machines have 2/3 cache levels, each with
more capacity and slower than before
Random Access Memory
( RAM )
 Volatile
 CPU requests that cannot be met in
cache will go to RAM
Access to Instructions

The hard disk is too slow to provide instructions to the CPU.


So programs are first loaded into main memory, which is much faster.
The CPU can then access the instructions more quickly.
Cache Memory

When an instruction or data is accessed from main memory, it is placed in


the cache. Second and subsequent use of the same instruction/data will
then be faster, since it is accessed directly from the cache.
Modul I/O

• Consists of 2 parts:
• Electronic components: Device
controller / controller
• Mechanical components: The device
itself
• Device controllers are a set of chips that
run physically.
• Different types of devices - different
software is needed to control them - device
drivers
Device Driver
• Run in the kernel
• Three ways to enter drivers into the kernel:
• Reconnect the kernel with the new driver and then
restart the system. Widely used by UNIX-based
systems
• Enter the operating system file and notify that the
driver needs to restart the system. When booting
all required drivers are loaded. Used by Windows
• OS is able to receive new drivers without having to
restart. Example: USB flash disk
Kernel is a software that makes communication between
computer applications and hardware, which provides system
services such as memory settings for processes that are running,
setting files, input-output to and from a device
Metode I/O
• Synchronous - waits until the I / O process is complete
• A thread starting an I / O operation will then enter state wait
until the I / O operation is complete
• When in wait state, the CPU is idle
• Asynchronous - other processes can run even though I / O
operations have not been completed
• A thread sends an I / O request to the kernel by calling the
appropriate function, if it is received by the kernel, the thread
will continue another process until the kernel notifies that the I /
O operation is complete. Then the thread will interrupt the
process it is working on and process the I / O operation data
BUS
• Communication paths between several
different devices
• Consists of 3 types:
• Address bus - address
communication line
• Data bus - data communication line
• Control bus - control signal path (eg
read / write)
Bus (Past)
Bus (Present)
• FSB - high speed main bus that
connects RAM, Processor, GPU (VGA
AGP)
Bridge - Another slower device
connected to a lower speed bus that is
connected to another bus that is faster
to the main bus
INTERUPSION
 Hardware or software requests services from
the CPU and the CPU will temporarily stop the
process it is doing to service the interruption
 Interruptions from hardware are usually sent
via certain signals
 Software interruptions by running a system
call. This system call will cause a trap /
exception (special interruptions generated by
software due to problems or requests for OS)
Excersize
 Explain how the processor and memory work
 Explain functions of the control unit (CU),
arithmetic logical unit (ALU), and registers
 Explain function of bus system and the types of
bus systems in computer
 Explain the I / O module and the example input
output device
Preparation for next week
 Install Linux
 Read Chapter 2 from the reference
“Operating Systems Internals and
Design Principles”

S-ar putea să vă placă și