Download Literatur Computer Systeme und Anwendungen Informatics 3

Survey
yes no Was this document useful for you?
   Thank you for your participation!

* Your assessment is very important for improving the workof artificial intelligence, which forms the content of this project

Document related concepts

Plan 9 from Bell Labs wikipedia , lookup

Library (computing) wikipedia , lookup

Acorn MOS wikipedia , lookup

Security-focused operating system wikipedia , lookup

Copland (operating system) wikipedia , lookup

RSTS/E wikipedia , lookup

Booting wikipedia , lookup

DNIX wikipedia , lookup

Distributed operating system wikipedia , lookup

Burroughs MCP wikipedia , lookup

Process management (computing) wikipedia , lookup

Spring (operating system) wikipedia , lookup

Unix security wikipedia , lookup

VS/9 wikipedia , lookup

CP/M wikipedia , lookup

Paging wikipedia , lookup

Transcript
Literatur Computer Systeme und Anwendungen
WS 05/06
Informatics 3
[1] C. Vogt: Betriebssysteme, Spektrum Akademischer Verlag,
Heidelberg Berlin, 2001
1. Hardware and Operating Systems
„Computer interior“ Linux, Windows
[3] Ralph Göstenmeier, Gudrun Rehn-Göstenmeier: Das
Einsteigerseminar LINUX, bhv Verlag, Kaarst, 1998
2. Database Systems
[4] Richard Stevens: Unix Network Programming, Prentice Hall 1990,
alte Auflage, ISBN 0 -13 94 98 76 – 1
Terms and Designs,
Language used by Database Systems SQL (Structured Query Language)
F.-J. Kauffels: Lokale Netze, MITP-Verlag Bonn, 12. Aufl., 2000
3. Encryption
[6] Tannenbaum: Moderne Betriebssysteme,
Carl Hanser Verlag München, 1995, 2. Aufl.
Symmetric and Asymmetric Encryption, Digital Signature, ...
4. Networks
[7] C. Hunt: TCP/IP Netzwerkadministration, O'Reilly, Köln, 1998, 2.
Aufl.
Data Packets and Network Addresses: Ethernet,
TCP/IP (connection oriented /connectionless Protocols)
Network Services (Protocols: DNS, HTTP, SMTP, POP, Security: Firewall)
[8] Peter Kleinschmidt, Christian Rank: Relationale Datenbanksysteme
Eine praktische Einführung , Springer-Verlag Berlin, 2002, 2. Aufl.
1.1 Operating Systems / Introduction
●
●
●
●
●
●
1.1 Operating Systems / Introduction
SS 2008
1.1.1 Basic Functions of Operating Systems (continued)
Provide Access to Data and Hardware, including Error Handling
●
Inf3 1
SS 2008
1.1.1 Basic Functions of Operating Systems
●
Kay Förger
Content:
[2] Wulf Alex, Gehard Bernör: UNIX, C und Internet, Springer-Verlag,
Berlin Heidelberg, 1994
[5]
SS 2008
●
Memory
Hard Disk (File System)
Output (Graphics Card), Input (Keyboard, Mouse, ...)
Network Interface Card , Wireless LAN Card
CD Drive
Special Cards (e.g. for Data Acquisition)
System Clock (Date, Time)
Support of Program Execution
●
Multitasking Support (Programs seem to run simultaneously,
Example: a PC is printing a text, one window is displaying the progress of a download
from the Internet, an other controls the copying process of a CD)
●
●
Application Program e.g. contains system call fopen(”E:\conf.ini“, ”r“)
Operating System
Hardware
Driver
Standard Electronic Circuit
additional Hardware
Software
Inf3 2
Multiuser Support (Distinguish different users of the system and
control their access to system resources)
Communication Interface: user/operating system
Inf3 3
1.1 Operating Systems / Introduction
Microsoft Windows
●
UNIX (SYS5 / BSD)
●
●
●
●
●
Multi-Task (support quasi simultaneous execution of programs)
●
File System (Permanent data storage: hard disk, memory stick, ...)
Linux (free Software (GPL), OpenSource)
commercial systems: Solaris (Sun), HP-UX (Hewlett-Packard),
AIX (IBM), SCO , Sinix/Reliant Unix (Siemens), ...
–
Implementation of a uniform access model to data
–
Spezial objects für computer hardware components
MAC-OS (Apple)
–
●
●
MAC-OS X
–
Mainframe Operating Systems (archaic)
●
●
●
●
Hard disk
Special devices ...
Links (hard, symbolic), fifo (pipe), Sockets
Networking: TCP/IP Protocol (IP: Internet Protocol).
Other manufactures used their own different protocols:
Apple (AppleTalk), Novell(IPX/SPX),
Microsoft: NetBEUI/NetBIOS, ...
MVS (IBM)
BS2000 (Siemens)
In former times: NOS-VE (CDC), VMS (Digital, Compac, HP)
Inf3 4
1.2 Operating Systems / Hardware
Battery
IDE
cabel:
hard disk
SS 2008
1.1.3 Features of the UNIX Operating System
● Multi-User (support different users)
1.1.2 Examples for Operating Systems
●
1.1 Operating Systems / Introduction
SS 2008
Inf3 5
SS 2008
1.2 Operating Systems / Hardware
ROM
chip set
integrated circuits
SS 2008
1.2.1 Fundamental Hardware Components:
●
Memory (basically two different types are distinguished)
RAM Random Access Memory
– ROM Read Only Memory (Stored information doesn't change; can only
–
Memory
be read)
●
CPU/
Fan
AGP socket(Graphik)
CPU Central Processing Unit (controls nearly all functions a
computer system: the processing and the handling of data)
PCI card
PCI socket
Power supply
Inf3 6
Inf3 7
1.2 Operating Systems / Hardware
1.2.1 Fundamental Hardware Components (continued)
●
1.2 Operating Systems / Hardware
SS 2008
SS 2008
Reset
CPU
IO-System Input Output System ( provides access to the following system
memory
components (Hardware) and drives them electrically)
hard disk, CD drive, ...
– serial / parallel interfaces
– Graphics card (A graphics card controls the information displayed on the
–
computer screen. The colour of each individual dot on the screen (Pixel) is stored and an
electrical signal is generated which drives the computer monitor).
–
Graphics Card
Network interface card (Connection to other computers
hard disk
Internet/Intranet, widely used network technology: Ethernet)
hard disk
network interface
Inf3 8
1.2 Operating Systems / Hardware
Reset
memory
RAM
CPU
1.2 Operating Systems / Hardware
SS 2008
ROM
Reset
Inf3 9
ROM
Instr. Counter
CPU
M
M
U
memory
RAM
Interrupt hand.
Chip set
Timer
Parallel
Serial
PS2
IO-System
chip set CMOS
Parallel
Serial
PS2
Input /
Output
E-IDE
SCSI
Network interface
Grafics card
Festplatte
Festplatte
Hint: all details which are not contained
in the previous transparency, are typeset
in italics.
Inf3 10
PCI-Bus
PCI-Bus
graphics card
E-IDE
Hard disk
SCSI
Hard disk
SS 2008
Structure of memory
Address
0
0/1 0/1 0/1 0/1 0/1 0/1 0/1 0/1
1
2
3
4
5
0/1 0/1 0/1 0/1 0/1 0/1 0/1 0/1
6
...
0/1 0/1 0/1 0/1 0/1 0/1 0/1 0/1
0/1 0/1 0/1 0/1 0/1 0/1 0/1 0/1
0/1 0/1 0/1 0/1 0/1 0/1 0/1 0/1
0/1 0/1 0/1 0/1 0/1 0/1 0/1 0/1
0/1 0/1 0/1 0/1 0/1 0/1 0/1 0/1
...
Network interface
Inf3 11
1.2 Operating Systems / Hardware
1.2.2 Memory
0
1
2
3
4
5
6
7
8
9
10
11
12
13
14
0
0 0
0 0 0 0
Dell Offer: 28.11. - 18.12.2007
contains on/off information (Bits)
0 0 0 0 0 1 0 0
a group of 8 Bits togehter form one Byte
0 0 1 1 0 0 1 0
0 0 1 1 0 0 1 1
0 0 0 0 1 0 0 1
1 0 0
Quotations from ct 25 (26.11.2007), page 90
The memory is organized in words,
usually multiples of one byte (8 bit)
0 0 0 0 0 0 1 1
0 1 1
SS 2008
Memory (main memory)
1
0 0 1 1 0 0 0 0
0
1.2 Operating Systems / Hardware
SS 2008
in former times: 8/16 Bit Worte (36 Bit)
1
nowadays: 64 Bit (32 Bit)
0 0 0 0 0 0 1 0
0 0 0 0 0 1 0 0
–
0 0 0 0 0 0 1 1
0 0 0 0 0 0 1 1
0 0 0 0 1 1 0 0
The words are numbered serially.
These numbers are called (memory)
addresses. First address: 0!
0 0 0 0 1 0 0 0
0 0 1 1 0 0 1 0
...
...
Inf3 12
1.2 Operating Systems / Hardware
SS 2008
1.2.2 Memory (continued):
27
128
26
64
0
0
0
0
0
0
Calculation of decimals from
binary coding
= 0*128 + 0*64 + 0*32 + 0*16
0*8 + 0*4 + 0*2 + 1*1 = 1
23
8
22
4
21
2
20
1
0
0
0
0
1
1
1
0
0
0
0
0
0
0
0
1
0
0
0
0
1
1
0
0
1
0
0
0
0
0
0
0
1
1
= 2+1 = 3
1
= 32+16+2+1 = 51
0
0
0
0
25 24
32 16
1
0
1
0
0
1
0
0
1
0
1
= 32+16 = 48
1.3 Operating Systems / System Start (Boot) SS 2008
1.3.1 First Actions (Program memory: BIOS/ROM):
1. BIOS / ROM Programm (After the PC is switched on a program is executed, which does
the initialization of the Computer. This Program is stored in the ROM (read only memory).
Additionally this memory contains subprograms which provide basic input output operations for
the electronic circuits. Name: Basic Input Output System = BIOS. In same cases all the
programs in the ROM are addressed as BIOS)
2. Offer the change of the BIOS Configuration (Setup)
=4
( basic configuration for electronic circuit (clock cycle), system date/time, ...)
In many cases started when the key <Entf> is pressed while the first few moments the computer
starts
= 32+16+2 = 50
3. Start the operating system from hard disk, CD, .. (=Boot-Media)
= 8+1 = 9
Hexa decimal numbers: 0 1 2 3 4 5 6 7 8 9 A B C D E F
In principal: the memory contains data and programs
Inf3 12a
10 11 12 13 14 15
Inf3 13
–
Direct start of the operating system
–
Or start of a selection program (boot manager) in order to have more than
one operating system on a computer (Windows different versions, Linux)
After the boot manager was run the selected operating system is started.
Inf3 14
1.3 Operating Systems / System Start (Boot) SS 2008
1.3.2 Actions During the Start of the Operating System
1.3 Operating Systems / System Start (Boot) SS 2008
1.3.3 Actions During the Start of the Operating System UNIX
–
Settings to handle Events (set memory register of the CPU and other electronic
components)
timer and generates interrupts after a time being set in advance. This interrupts the program
execution and skips to a program part of the operating system which analyses the state of the
system. After this the execution of the program is continued or a other program is executed.
Analysis of the Computer Hardware
●
●
Timer: Set a basic time interval to control the system
behaviour it is used to switch from task to task. There is a electronic device which is called
Register Electronic Devices, which are mounted
Initialize the Devices to control the function of them
–
Basic Setup of the Schedulers program part of the operating system which
control the execution of programs which seem to be run at the same time (quasi parallel
execution)
●
●
Inf3 16
1.3 Operating Systems / System Start (Boot) SS 2008
–
–
Run the First Program (UNIX runs program init)
●
Load in Memory (from hard disk)
Start the Program:
–
–
–
1.3 Operating Systems / System Start (Boot) SS 2008
1.3.3 Actions During the Start of the Operating System UNIX
Mount the Root File System (The root file system is usually located on hard
disk. There all permanent programs and data. Program and data are stored as a file which can be
accessed by the use of a file name. The size of a file can be very different varying form a few
bytes (for a short text file) to gigabytes (for a video film). The operating system controls in
which blocks (head, cylinder, sector number is required to address a data block on hard disk) the
data are stored on the hard disk and which block belongs in what sequence to an individual file.
●
Setup of the Memory Management (address mapping table) (virtual
Computer) to enable a more flexible use of a computer memory addresses can be
translated by a special electronic device in a computer (MMU) before accessing the memory
to real memory addresses. This enables a more flexible use of the memory. Parts of the
memory which were not used for some time can be saved to disk and loaded in a other part
of the memory if needed again. In this case nothing but the memory mapping table has to
changed the running application program can remain unchanged. The application programs
can be programmed as if there was a large continuous RAM (memory) but may be only part
of the program and the data are stored in the real main memory. From the programming
point of view it seems as if each running program (=process) uses it own computer (virtual
computer) .
Inf3 15
1.3.3 Actions During the Start of the Operating System UNIX
Initialize the List of program being run (=active processes) to an empty list
–
Mount additional file systems on other hard disks or on
partitions
–
Add Swap Space (parts of the memory not used for a longer period of time will be
stored on a special section of the hard disk. This is called paging.
In the German Windows a file is used called Auslagerungsdatei:
c:\pagefile.sys
Configuration of Size:
Assign a process number (for init: 1, because it is the first process started)
Change (toggle) the memory mapping
Toggle the CPU from system mode to user mode (some instructions (commands)
of the CPU instruction set can only be used in system mode i.e. change the memory
mapping. This guaranties the a user program can't mess up the memory management
of the operating system because the execution of certain instruction is prohibited in
user mode and only possible in system mode). The CPU automatically switches back
to system mode if an interrupt is received and the interrupt handling program part of
the operation system is executed.
Inf3 17
Systemsteuerung -> System
(Systemeigenschaften) >>Erweitert, Systemleistung ->Einstellungen
(Leistungsoptionen) >>Erweitert, Vritueller Arbeitsspeicher ->Ändern
-> means: Click on a button
>> means: Change the view of a tab by clicking on an other tab.
Start the Task-Managers: key combination <Strg>+<Alt>+<Entf>
Windows: next transparency
Inf3 18
1.3 Operating Systems / System Start (Boot) SS 2008
1.3.3 Actions During the Start of the Operating System UNIX
–
Windows (z.B. XP)
<Strg>+Alt+Entf
1.4 Operating Systems / Memory Management SS 2008
Memory: Application Address mapping ...
Programming
by MMU
256
Point of view
257
(Prozess address space)
1.5 Operating Systems / Events
–
Day-to-day life:
–
–
●
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
258
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
259
0
0
0
0
0
0
0
0
2
0
0
0
0
0
0
0
0
260
0
0
0
0
0
0
0
0
3
0
0
0
0
0
0
0
0
261
0
0
0
0
0
0
0
0
4
0
0
0
0
0
0
0
0
262 0
0
0
0
0
0
0
0
5
0
0
0
0
0
0
0
0
263 0
0
0
0
0
0
0
0
6
0
0
0
0
0
0
0
0
264 0
0
0
0
0
0
0
0
7
0
0
0
0
0
0
0
0
265 0
0
0
0
0
0
0
0
266 0
0
0
0
0
0
0
0
267 0
0
0
0
0
0
0
0
...
Part being swapped to hard disk
...
...
1.5 Operating Systems / Events
Inf3 20
SS 2008
1.5.2 Treatment of Events
An event is not predictable and occurs spontaneously
Example:
●
0
0
SS 2008
1.5.1 Explanation
0
0
...
Inf3 19
Main Memory(RAM)
...
To be interrupted while doing something by a phone call. The ringing of the
phone can be regarded as an event (not predictable).
During a car ride the traffic light changes from green to red. The event is the
change of the light.
–
Interrupt of the step by step execution of a running program
–
Start of the operating system interrupt handler (This is a porgram
part which is executed if an event occurs. Which program part is executed on which even is
predefined on system start (see 1.3.2). Of course events can be ignored. To define this an
interrupt mask is prescribed.
Computer:
–
–
–
–
–
Clicking a key on the keyboard
Move and click the mouse
Program crash (the operating system regards this as an event)
A data packet arrives which was send across the network
...
Inf3 21
Inf3 22
1.5 Operating Systems / Events
1.5.3 Sources (trigger) of Events Generating CPU Interrupts
–
1.5 Operating Systems / Events
SS 2008
1.5.3 Sources (trigger) of Events Generating CPU Interrupts
Events from Electronic Devices (Hardware Interrupt) (were
–
reported to the CPU by some pins)
–
–
–
–
SS 2008
Hard Disk: Data (for file access) is ready
Sound card, TV- card, network interface card
Memory not available (may be moved to hard disk: swap, event source
MMU ) Actions:
● Instruct hard disk to read the disk block with the memory data
● New Process status: wait (until memory is back from hard disk)
Timers (=time is over) => Operating system analysis of the
system state is required
●
●
Internal action required?
Scheduler:
●
●
●
System Call (Service request to the operating system by a running ) program
(=Process) (Software Interrupt) (is initiated by a CPU instruction)
●
–
–
Is there a other active process?
Run the process required? (Analysis of Priority, runt times an
waiting times)
Can processes be continued because requested data arrived in the
mean time?
Change the settings of the MMU (and other devices) and switch
from system to user mode and continue executing a user/application
program
... additional events
Inf3 23
1.6 Operating Systems / Processes
SS 2008
1.6.1 Definition of the Term Process [Task]
Inf3 24
1.6.2
1.6 Operating Systems / Processes
stack
Execution of a Program controlled by the operating system.
SS 2008
data segment
(program data)
(Hint: one program can be started many times. On each start an new process is created)
–
The operating system creates a virtual Computer for each
program it runs. i.e. Before execution of program instructions the MMU setup
is changed to restrict the memory access to the parts of the RAM which belong to the
program.
●
●
The program addresses are mapped to the real memory adresses by
a table and calculations in the MMU. The program addresses are
also called virtual addresses because they refer to a virtual
computer.
The set of all virtual addresses is called process address space or
virtual address space.
kernel data
heap
uninitialized data
initialialized read write
initialialized read only
Text Segment
(program instructions)
Inf3 25
Kernel Kontext
(data to contol the execution
used by the operating system)
This part is read from
the program file on
hard disk
Inf3 26
1.6 Operating Systems / Processes
0
initialialized read write:
values are prescribed,
can be read and changed
int factorial( int n ) {stack: memory for
functions calls
int e,i;
e = 1;
for (i=2; i<=n; i++)
uninitialized data:
e = e*i;
no values are assigned,
return e;
read/write: OK
Text Segment
}
programm instructions
initialialized read only:
main() {
cannot be modified.
printf(fmt);
scanf("%i", &k);
printf("%i! = %i\n", factorial(k));
fmt = malloc(10000);
heap: dynamically assigned memory
free(fmt);
provided by the operating system at run time
}
Inf3 27
1.6 Operating Systems / Processes
Process A
stack
stack B
stack A 1
1.6 Operating Systems / Processes
SS 2008
Process B
stack
Process A
stack A 2
heap
Create process:
fork();
uninitialized
Data A
uninitialized
Data B
initialized A
read write
initialized B
read write
initialized
read only
Text Segment
(Programmcode)
Main memory
uninitialized
Data A
uninitialized
Data
initialized
read write
initialized
read only
Text Segment
(Programmcode)
SS 2008
initialized A
read write
initialized
read only
Set of all addresses of a process
= process address space
Text Segment
(Programmcode)
Inf3 28
1.6 Operating Systems / Processes
SS 2008
1.6.4 Attributes of a Process
Values to characterize a process
●
stack A 2
heap B
heap
stack A 1
heap A
SS 2008
heap A
uninitialized
Data
initialized
read write
initialized
read only
Text Segment
(Programmcode)
main memory
stack
0
Main memory addresses
#include <stdio.h>
integer k = 7;
integer a[1000];
char * fmt = "Please enter n";
process addresses
1.6.3
heap
●
uninitialized
Data
initialized
read write
initialized
read only
Text Segment
(Programmcode)
●
Porcess ID (pid) unique number (short integer), is assigned to each
process by the operating system (kernel)
(query in a C program: function call: getpid())
Parent Process ID (Number of the process which generated this process.
Function (system) calls: fork(), getppid().)
User ID
–
–
●
–
Inf3 29
●
Real (uid, short integer) getuid()
Effektiv (valid for file access) (euid, short integer) geteuid()
Group ID (Number to identify a group of users)
–
Hint: The memory
mapping some time after
the new process started
is displayed here.
(Number to identify a user)
Real (gid, short integer) getgid()
Effective (valid for file access) (egid, short integer) getegid()
Priority (nice value) (Attribute controls runtime assignment to processes)
Inf3 30
1.6 Operating Systems / Processes
1.6.4 Attributes of a Process (continued)
–
Prozess terminated (Runtime information is still needed): <defunct>
Start
ready
End
(Termination)
–
Working Directory (see exercises)
–
Table of Resources (for example: all data to access open files on hard disk)
–
Process-Group ID (on process can become the leader of a set of processes. This set
is called the process group. With some system calls all processes of a process group can be
adressed)
–
Terminal-Group ID (/dev/tty) (group of processes using the same
input/output channel, for example the same PuTTY window)
–
Environment Variables (pair of stings: one string is used as index to store a string
value: to set the language use LANG=EN, the first string LANG is the index, value is EN )
–
Umask (set permissions for the creation of new files)
–
User Limits (ulimit) (set limits for process: execution time, memory,
files (number, size), number of (sub)processes created, ...)
running
Revoke assignment of CPU
Event occurred
SS 2008
1.6.4 Attributes of a Process (continued)
Status: sleeping (waiting), running, Kernel-Call (Operating system
function call), trace (Debug),
Assign CPU
1.6 Operating Systems / Processes
SS 2008
Wait for an
event
waiting
Inf3 31
1.6 Operating Systems / Processes
Can be received by a process (and handled or ignored. This is controlled by
the operating system and is distinct from events/interrupts received by the CPU from
electronic devices)
–
Hardware (if the CPU receives an interrupt while executing instructions of a user
program due to some program error the execution is interrupted and the interrupt handler
program part of the operating systems is run. As a result the process can receive a signal)
–
–
–
●
●
Divide by zero (Source: Floating point unit; Signal: Floating Point
Exception SIGFPE)
Illegal memory access (Source: MMU; wrong address i.e. Not assigned to
the process, attempt to write to a protected region; Signal: Segment
Violation SIGSEG)
...
Operating System (Timer to wake up a process: SIGALRM,
user enters <Strg>+C: SIGINT, ...)
Other processes (System call kill(pid, signal), signals: SIGKILL, SIGTERM, SIGUSR1, SIGUSR2, ...)
Handler (is started when the signal is received, system call to install the handler:
signal(signal, handler); Definition handler: void handleSig(int sig_no){ ... }
Inf3 33
SS 2008
1.6.6 Critical Regions (German: Kritische Abschnitte)
–
Lock Variable (Stores the value of the signal)
–
Test and Set must be performed in one interruptible (atomic)
operation
–
Picture p. 92, [1] (C. Vogt: Betriebssysteme, Spektrum
Akademischer Verlag, Heidelberg Berlin, 2001)
Sources (for example: all data to access open files on hard disk)
●
–
1.6 Operating Systems / Processes
SS 2008
1.6.5 Signals
–
Inf3 32
Stop if signal
is red
Change signal
to green
Change
signal to red
critical
region
Stop if signal
is red
Change
signal to red
Change signal
to green
Inf3 34
1.6 Operating Systems / Processes
1.6.6 Critical Regions (continued)
–
1.6 Operating Systems / Processes
SS 2008
SS 2008
1.6.7 Dead Locks (German: Verklemmungen)
Semaphore (Generalization of Lock Variable) (Stores the value of
the signal)
–
Possible Operations:
●
●
●
Initialize S(set a start value for example to the number of available resources)
Pass (request one resource, if not available wait until the resource becomes available)
Release (the resource)
Example: Traffic jam
Prerequisite for a Resource:
●
●
●
Exclusive usage
Cannot be withdrawn
1 < n Resources
Picture p. 105, [1] (C. Vogt: Betriebssysteme, Spektrum
Akademischer Verlag, Heidelberg Berlin, 2001)
Inf3 35
Inf3 36