Buscar

PRCMP-T04-EN

Faça como milhares de estudantes: teste grátis o Passei Direto

Esse e outros conteúdos desbloqueados

16 milhões de materiais de várias disciplinas

Impressão de materiais

Agora você pode testar o

Passei Direto grátis

Você também pode ser Premium ajudando estudantes

Faça como milhares de estudantes: teste grátis o Passei Direto

Esse e outros conteúdos desbloqueados

16 milhões de materiais de várias disciplinas

Impressão de materiais

Agora você pode testar o

Passei Direto grátis

Você também pode ser Premium ajudando estudantes

Faça como milhares de estudantes: teste grátis o Passei Direto

Esse e outros conteúdos desbloqueados

16 milhões de materiais de várias disciplinas

Impressão de materiais

Agora você pode testar o

Passei Direto grátis

Você também pode ser Premium ajudando estudantes
Você viu 3, do total de 25 páginas

Faça como milhares de estudantes: teste grátis o Passei Direto

Esse e outros conteúdos desbloqueados

16 milhões de materiais de várias disciplinas

Impressão de materiais

Agora você pode testar o

Passei Direto grátis

Você também pode ser Premium ajudando estudantes

Faça como milhares de estudantes: teste grátis o Passei Direto

Esse e outros conteúdos desbloqueados

16 milhões de materiais de várias disciplinas

Impressão de materiais

Agora você pode testar o

Passei Direto grátis

Você também pode ser Premium ajudando estudantes

Faça como milhares de estudantes: teste grátis o Passei Direto

Esse e outros conteúdos desbloqueados

16 milhões de materiais de várias disciplinas

Impressão de materiais

Agora você pode testar o

Passei Direto grátis

Você também pode ser Premium ajudando estudantes
Você viu 6, do total de 25 páginas

Faça como milhares de estudantes: teste grátis o Passei Direto

Esse e outros conteúdos desbloqueados

16 milhões de materiais de várias disciplinas

Impressão de materiais

Agora você pode testar o

Passei Direto grátis

Você também pode ser Premium ajudando estudantes

Faça como milhares de estudantes: teste grátis o Passei Direto

Esse e outros conteúdos desbloqueados

16 milhões de materiais de várias disciplinas

Impressão de materiais

Agora você pode testar o

Passei Direto grátis

Você também pode ser Premium ajudando estudantes

Faça como milhares de estudantes: teste grátis o Passei Direto

Esse e outros conteúdos desbloqueados

16 milhões de materiais de várias disciplinas

Impressão de materiais

Agora você pode testar o

Passei Direto grátis

Você também pode ser Premium ajudando estudantes
Você viu 9, do total de 25 páginas

Faça como milhares de estudantes: teste grátis o Passei Direto

Esse e outros conteúdos desbloqueados

16 milhões de materiais de várias disciplinas

Impressão de materiais

Agora você pode testar o

Passei Direto grátis

Você também pode ser Premium ajudando estudantes

Prévia do material em texto

Princípios da 
Computação 
Introduction to operating systems.
General view of a computing system
• Hardware: the physical machine 
that executes computation.
• Operating system: software that 
manages the computer hardware.
• Applications: system programs 
and application programs.
• Users: persons, other systems, 
machines…
Hardware
Operating system
Ap
pl
ic
at
io
n 
pr
og
ra
m
Ap
pl
ic
at
io
n 
pr
og
ra
m
Sy
st
em
 
pr
og
ra
m
Sy
st
em
 
pr
og
ra
m
General view of a computing system
• This is a generic view of a computing 
system!
• There are systems that do not have 
an operating system.
• There are systems that only admit 
one program at a time.
• There are systems that only admit 
one user at a time.
• Currently there is a reasonable diversity 
of computing systems!
Hardware
Operating system
Ap
pl
ic
at
io
n 
pr
og
ra
m
Ap
pl
ic
at
io
n 
pr
og
ra
m
Sy
st
em
 
pr
og
ra
m
Sy
st
em
 
pr
og
ra
m
Why do we need an operating system?
• Computer systems are built to execute user programs, to solve user problems easier.
• However, bare hardware is not easy to use!
• Programs use certain common operations: e.g. memory allocation, file 
operations, controlling I/O devices, etc.
• Writing these operations in every program is laborious and cumbersome.
• An operating system provides the common functions of controlling and allocating 
computer resources.
• Programs request these functions!
General goals of an operating system
• The main goal of an OS is to facilitate the operation of the 
computer.
• Manage the hardware resources in an efficient way.
• Provide programs a controlled access to hardware resources.
• Provide an environment to facilitate program loading and 
execution.
• Error detection.
User oriented functions
• User interface: 
• Provide users the access to OS functionality: command-line interface 
(CLI), batch interface (BI), graphical user interface (GUI).
• Program execution: 
• Load programs into memory and run those programs.
• I/O operations: 
• Provide controlled access to I/O devices, i.e. the programs request the 
OS to execute such operations.
User oriented functions
• File system manipulation: 
• File system organisation (e.g. directories, permissions).
• File operations: create, read, write, delete.
• Communications: 
• Allow communications between programs executing on the same or different machines.
• Error detection: 
• Detect errors and execute the appropriate actions.
• E.g. return an error code to the program, terminate a faulty program, halt the system.
System efficiency oriented functions
• Resource allocation: 
• Manage resource allocation to programs.
• E.g. access to CPU execution time, main memory, file storage and I/O 
devices.
• Accounting: 
• Register which resources and how much users use those resources.
• Useful for billing users.
• Usage statistics allow to plan system reconfiguration.
System efficiency oriented functions
• Protection and security: 
• Protect the the hardware and the OS from programs, enforcing 
controlled access.
• Avoid that a program interferes with other programs (i.e. corrupts 
code or data of other programs).
• Require user authentication to the system to provide access to 
system resources.
• Repel invalid external accesses.
Evolution of operating systems
Serial processing
• First stored-program computers did not have an 
operating system.
• Programs were not interactive (no user intervention).
• The programmer would manually load the 
program into main memory.
• Then, the programmer would start the 
program acting on the buttons of the console.
• Program data was loaded from secondary 
storage (punched cards, magnetic tapes) 
during execution.
• The execution of the program was monitored 
by inspection of console control lights 
("neons") and printed output. 
Serial processing
• Setting a computer to execute a program was very 
time-consuming: all human-performed operations.
• Detecting and correcting an error was even more time-
consuming: inspecting machine code, registers and 
memory!
• The computer was a very expensive machine but, at 
the end of the day, its utilisation time was low!
Serial processing
Time
CPU I/O CPU I/O CPU
CPU I/O CPU
Setting the computer 
for the next program 
(time consuming)
Program A
Program B
• Highly inefficient: most of the time, the CPU is idle.
Batch processing
• As time went by, hardware was becoming 
constantly faster.
• Programs were (still) not interactive.
• Higher level programming languages appeared.
• Libraries of common functions and device 
drivers made programming easier.
• However each program had to be compiled before 
being executed: computer operation was more 
complex!
• Load compiler, compile source code, load 
program, execute program, repeat…
• … all operated by humans (low efficiency).
Batch processing
• Automatic job sequence: the resident 
monitor.
• First approach of an operating system.
• Program always resident in memory:
• Monitor loads and starts a 
program.
• When program terminates, control 
returns to monitor, that loads and 
starts next program.
User program area
Monitor
Loader
Job sequencing
Control card interpreter
Batch processing
• Operator sets a deck of control cards, 
defining the sequence of programs 
the monitor must run: the batch.
• The control card interpreter reads 
and carries out the instructions on the 
cards.
• The loader loads programs into main 
memory.
• Sequence repeats automatically until 
the end of the batch.
User program area
Monitor
Loader
Job sequencing
Control card interpreter
Batch processing
Time
CPU I/O CPU I/O CPU
CPU I/O CPU
Program A
Program B
Automatic job 
sequencing 
(faster) CPU I/O CPU
Program C
• The CPU utilisation is still low!
• The execution time of a program is predominantly dictated by I/O operations!
Advances in technology
• I/O devices equipped with controllers were able to perform operations 
autonomously, signalling the processor when done.
• Processors could execute other instructions while I/O operations were executed 
by peripherals.
• Memory density increasing and memory cost decreasing.
• Computers with more and more RAM.
• Disk systems allowed random access.
• Disks could be used as secondary memory: a suspended program could be 
transferred temporarily to disk, to be loaded back to memory later on.
Multiprogramming
• Multiple programs are loaded into 
primary memory.
• The CPU interleaves the execution 
of programs loaded in RAM.
• A program that requests an I/O 
operation, yields the processor 
to another program: context 
switch.
• The CPU is never idle while there is 
work to do!
CPU
Operating system
Job A (waiting for CPU)
Job B (I/O)
Job C (executing)
Disk
I/O operation Execution 
in progress
RAM
Multiprogramming
Time
CPU dev1 CPU dev1 CPU
CPU dev2 CPU
Program A
Program B
CPU dev1 CPU
Program C
• The CPU idles when no program is ready to execute.
• CPU utilisation is optimised!
Process
• The operating system must keep track of the state of each of the multiple programs that are active. For 
each program, it must register:
• the program counter,
• the CPU registers,
• the stack,
• the memory map.
• Additionally, it must ensure isolation between programs.
• The process is an instance of a computer program, containing the program code, data and its current 
state.
• A process is self-contained and it does not intersects with other processes.
Swapping
• Context switching is only effective if programs are in RAM.
• However, physical memory is limited and may be insufficient to load all active 
programs.
• Swap from RAM to disk a program that is suspended in a I/O operation.
• Swap program back to RAM when it is time to resume its execution.
• This technique allows programs to use more memory than it is physicallypresent. 
However, swapped memory should kept to a minimum!
• Swapping may become overwhelming, degrading the system performance to a 
possible collapse! This condition is called thrashing.
Time sharing
• Multiprogramming settled the ground for:
• interactive programs: a program can wait for user 
input (I/O), while the CPU is potentially executing 
other programs;
• time-sharing: multiple users share the computing 
resources, making a more efficient use of the 
computer.
Time sharing
• The user interacts with the 
computer using a terminal. The 
terminal is connected to the 
computer by a network.
• The user types on the keyboard 
the next program to execute.
• Process switching is sufficiently 
fast to allow interaction between 
the users and their processes.
OS support for time-shared systems
• Multiple users and concurrent processes required tackling new issues:
• CPU scheduling: responsive scheduling strategies.
• Memory management: allocation of memory to multiple processes; 
memory protection; virtual addresses; memory swapping.
• I/O management: manage concurrent I/O operations.
• File management: file integrity; file access; file protection.
• Security: user authentication; integrity of user programs, data and files.

Outros materiais