Introduction to Operating Systems and Data Communication

Download Report

Transcript Introduction to Operating Systems and Data Communication

INF1060:
Introduction to Operating Systems and Data Communication
Operating Systems:
Summary
What is an Operating System (OS)?

“An operating system (OS) is a collection of programs that acts as an
intermediary between the hardware and its user(s), providing a high-level
interface to low level hardware resources, such as the CPU, memory, and
I/O devices. The operating system provides various facilities and services
that make the use of the hardware convenient, efficient, and safe”
Lazowska, E. D.: Contemporary Issues in Operating Systems , in: Encyclopedia of Computer Science, Ralston, A., Reilly, E. D. (Editors), IEEE Press, 1993, pp.980
 It is an extended machine (top-down view)
 Hides the messy details
 Presents user with a virtual machine, easier to use
 It is a resource manager (bottom-up view)
 Each program gets time with the resource
 Each program gets space on the resource
INF1060 – introduction to operating systems and data communication
user
application
operating
system
hardware
2004 Kjell Åge Bringsrud & Pål Halvorsen
Primary Components
 Apparent to user
 Shell
 File system
 Device management
 Transparent
 Processor management
 Memory management
 Communication services
Application program layer
Operating system layer
User interface
(shell)
File
management
Device
management
Processor
(or process)
management
Memory
management
Communication
services
Hardware layer
INF1060 – introduction to operating systems and data communication
2004 Kjell Åge Bringsrud & Pål Halvorsen
Processes vs. Programs
 What is a process?
 a program is a set of instructions how to perform a task
 the execution of a program is called a process

analogy: receipt vs. chef
INF1060 – introduction to operating systems and data communication
2004 Kjell Åge Bringsrud & Pål Halvorsen
Scheduling
 A task is a schedulable entity/something that can run
(a process/thread executing a job, e.g.,
a packet through the communication
requests
system or a disk request through the file system)
 In a multi-tasking system, several
tasks may wish to use a resource
simultaneously
scheduler
 A scheduler decides which task
that may use the resource,
i.e., determines order
by which requests are serviced,
using a scheduling algorithm
resource
 Scheduling performance criteria and goals are dependent on
environment and workload
INF1060 – introduction to operating systems and data communication
2004 Kjell Åge Bringsrud & Pål Halvorsen
CPU Scheduling
 Preemptive
 currently executing task may be interrupted (preempted) by higher
priority processes
 preempted process continues later at the same state
 Non-preemptive
 running tasks will be allowed to finish its time-slot (higher priority
processes must wait)
 Many different scheduling algorithms
 modern systems, like Windows and Linux, use some kind of priority
based scheduling
 the right time slice can improve overall utilization
INF1060 – introduction to operating systems and data communication
2004 Kjell Åge Bringsrud & Pål Halvorsen
Memory
 Memory management is concerned with managing the systems’ memory
resources

allocating space to processes

protecting the memory regions

in the real world

programs are loaded dynamically

physical addresses it will get are not known to program – dynamic address translation

program size at run-time is not known to kernel
 Each process usually has text, data and stack segments
 Systems like Windows and Unix use
virtual memory with paging
 Many issues when designing a memory component
INF1060 – introduction to operating systems and data communication
2004 Kjell Åge Bringsrud & Pål Halvorsen
Segmentation & Paging
 Requiring that a process is placed in contiguous memory gives much fragmentation
(and memory compaction is expensive)
 Segmentation
 different lengths
 determined by programmer
 memory frames

programmer (or compiler tool chain) organizes program in parts


move control
needs awareness of possible segment size limits
 Paging
 equal lengths (determined by processor)
 one page moved into one memory frame

process is loaded into several frames (not necessarily consecutive)
 Memory lookup and address translation via tables, e.g., page table
 Many different page replacement algorithms, e.g., FIFO, Clock, LRU, …
INF1060 – introduction to operating systems and data communication
2004 Kjell Åge Bringsrud & Pål Halvorsen
Virtual Memory & Memory Lookup
present
bit
Page table
15
14
13
12
11
10
9
8
7
6
5
4
3
2
1
0
000
000
000
000
111
000
101
000
000
000
011
100
000
110
001
010
0
0
0
0
1
0
1
0
0
0
1
1
1
1
1
1
Incoming virtual address
(0x2004, 8196)
Outgoing physical address
1 1 0
(0x6004, 24580)
Example:
• 4 KB pages (12-bit offsets)
• 16 bit virtual address space  16 pages (4-bit index)
• 8 physical pages (3-bit index)
4-bit index
into page table
virtual page = 0010 = 2
12-bit offset
0 0 1 0 0 0 0 0 0 0 0 0 0 1 0 0
INF1060 – introduction to operating systems and data communication
2004 Kjell Åge Bringsrud & Pål Halvorsen
Storage
 Disks are the main persistent secondary storage device
 The main bottleneck is often disk I/O performance due to disk
mechanics: seek time and rotational delays
 Much work has been performed to optimize disks performance
 scheduling algorithms try to minimize seek overhead
(most systems use SCAN derivates)


memory caching can save disk I/Os
additionally, many other ways (e.g., block sizes, placement, prefetching, …)
 World today more complicated
(both different access patterns, unknown disk characteristics, …)
 new disks are “smart”, we cannot fully control the device
INF1060 – introduction to operating systems and data communication
2004 Kjell Åge Bringsrud & Pål Halvorsen
Storage
 File systems provide an abstraction to
 file management – store, share, access, …
 storage management – management of physical storage
 access methods – functions to read, write, seek, …
 …
 Files are often organized in hierarchical directories
 Many ways to manage file blocks, but many modern systems
often use a variant of index-based management with a table of
pointers (inodes or improvements)
INF1060 – introduction to operating systems and data communication
2004 Kjell Åge Bringsrud & Pål Halvorsen
Inter-Process Communication (IPC)
 Many ways to perform send messages or perform IPC
on a machine, and we have briefly looked at

mailboxes - FIFO, messages has types

pipes – FIFO, no type

shared memory – shared memory mapped into virtual space

signals – send a signal which can invoke a special handler
INF1060 – introduction to operating systems and data communication
2004 Kjell Åge Bringsrud & Pål Halvorsen
Where to Continue?
 If you like…

… programming languages




… operating systems


INF2100 – Project assignments in programming
INF3110 – Programming languages
(INF5110 – Compiler techniques)
INF3150 & INF3160 – Operating systems 1 & 2
… data communication



INF3190 – Data communications
(INF5050 – Protocols and routing in the Internet)
(INF5060 – Multimedia Networking using Network Processor Cards)
INF1060 – introduction to operating systems and data communication
2004 Kjell Åge Bringsrud & Pål Halvorsen