510 likes | 520 Views
Explore the evolution of operating systems, system calls, computer hardware, and key OS concepts. Learn about the diverse operating system zoo, from mainframes to embedded systems. Delve into memory hierarchy, I/O devices, and process management within operating systems. Discover the intricate layers of file systems and the vital role of system calls for process management.
E N D
Chapter 1 Introduction 1.1 What is an operating system 1.2 History of operating systems 1.3 The operating system zoo 1.4 Computer hardware review 1.5 Operating system concepts 1.6 System calls 1.7 Operating system structure
Introduction • A computer system consists of • hardware • system programs • application programs
What is an Operating System • It is an extended machine • Hides the messy details which must be performed • Presents user with a virtual machine, easier to use • System calls • It is a resource manager • Each program gets time with the resource • Each program gets space on the resource
Resource Manager • Tempo • CPU, impressora, usuarios • Espaco • Disco, memoria
History of Operating Systems (1) Early batch system • bring cards to 1401 • read cards to tape • put tape on 7094 which does computing • put tape on 1401 which prints output
History of Operating Systems (2) • First generation 1945 - 1955 • vacuum tubes, plug boards • Second generation 1955 - 1965 • transistors, batch systems • Third generation 1965 – 1980 • ICs and multiprogramming • Fourth generation 1980 – present • personal computers
2nd geration • Structure of a typical FortranMonitorSystem job – 2nd generation; desperdicio de CPU
3rd generation • Multiprogramming system, many jobs in memory • Time sharing • MULTICS (multiplexed information and computing service) → UNICS,
4th generation • Personal computers • Graphical user interface: Windows • Minix (microkernel) → Linux (monolitco, GNU, X-windows)
The Operating System Zoo • Mainframe operating systems • Server operating systems • Multiprocessor operating systems • Personal computer operating systems • Real-time operating systems • Embedded operating systems • Smart card operating systems
Computer Hardware Review (1) Monitor • Components of a simple personal computer Bus
1) Processador ciclo de busca, execucao registradores: PC, SP, PSW (CPSR) modo kernel/user; kernel = supervisor TRAP pipeline (RISC), varias unidades de execucao
Computer Hardware Review (2) (a) A three-stage pipeline (b) A superscalar CPU
2) Memoria memoria volatil x nao volatil multiprogramacao: Varios processos na memoria Como obter memoria grande e barata? Como proteger os processos uns dos outros? Como tratar a realocacao do codigo?
Typical memory hierarchy numbers shown are rough approximations
Hierarquia de memoria Cache: quando coloca e remove dado no cache? Chaveamento de processo e cache miss.
Protecao e realocacao de codigo One base-limit pair and two base-limit pairs b) codigo compartilhado
Protecao e realocacao de codigo MMU - Memory Management Unit Ao chavear processos, cache vira lixo
3) Dispositivos de Entrada/Saida HW: controladora, dispositivo controladora: acesso via portas pode ser complexo (calcular onde estah setor do disco) interface padronizada: ex: IDE SW: Drivers fabricante ou engenharia reversa instalacao: kernel ou modulo
I/O é lerdo Como a CPU pode trabalhar enquanto I/O nao fez leitura ou escrita?
Interrupcao (a) Steps in starting an I/O device and getting interrupt (b) How the CPU is interrupted (a) (b)
Interrupcao, exemplo 1. CPU programa controladora de disco para leitura 2. Disk controller avisa dados lidos 3. interrupcao (alguem interrompeu). 4. mostra quem interrompeu
Computer Hardware Review (7) Structure of a large Pentium system
Processes . Program in execution . Address space: code, data, stack . Process table: • list of open files, state, UID . Communication • sinais (divisao por zero), mensagens . scheduling
Processes • A process tree (fork, exec, wait; UID, GID) • A created two child processes, B and C • B created three child processes, D, E, and F
Processes (a) A potential deadlock. (b) an actual deadlock.
Main memory Holds executing programs Multiple programs - protection Large programs - virtual memory system calls para compartilhar memoria, mapear arquivos em memoria.
File Systems File system for a university department
Files . Abstract model of device independent files . Hierarchy, directories, operations . Absolute, relative paths; . root and working direcotry . special files (I/O devices): block, character . security (rwx,)
Operating System Concepts (4) • Before mounting, • files on floppy are inaccessible • After mounting floppy on b, • files on floppy are part of file hierarchy
Operating System Concepts (5) Two processes connected by a pipe
Steps in Making a System Call There are 11 steps in making the system call read (fd, buffer, nbytes)
System calls . interface user process to kernel . machine dependant, but in procedure libraries (POSIX)
Some System Calls For Process Management pid = fork() pid = waitpid(pid, &statlock, opts) s = wait(&status) s = execve(name, arg, envp) exit(status) pid = getpid()
Signals s=sigaction(sig,&act,&oldact) s=sigreturn(&context) s = sigpending(set) s = sigsuspend(sigmask) s = kill(pid, sig) residual = alarm(seconds) s = pause()
Some System Calls For Miscellaneous Tasks s = chdir(dirname) s = chmod(name, mode) s = kill(pid, signal) seconds = time(&seconds)
System Calls (1) • A stripped down shell: while (TRUE) { /* repeat forever */ type_prompt( ); /* display prompt */ read_command (command, parameters) /* input from terminal */ if (fork() != 0) { /* fork off child process */ /* Parent code */ waitpid( -1, &status, 0); /* wait for child to exit */ } else { /* Child code */ execve (command, parameters, 0); /* execute command */ } }
System Calls (2) • Processes have three segments: text, data, stack
System Calls (3) (a) Two directories before linking/usr/jim/memo to ast's directory (b) The same directories after linking
System Calls (4) (a) File system before the mount (b) File system after the mount
System Calls (5) Some Win32 API calls
Operating System Structure (1) Simple structuring model for a monolithic system
Operating System Structure (2) Structure of the THE operating system • camadas bem delimitadas, • Multix - aneis concentricos - traps entre as camadas
Operating System Structure (3) Structure of VM/370 with CMS • CMS - Conversational Monitor System • VM: Virtual Machine Monitor • MS-DOS / Pentium • JVM
Operating System Structure (4) The client-server model microkernel mecanismo x politica MINIX
Microkernel x monolitico - Por que microkernel é bom? • Tanenbaum: codigo limpo - Por que microkernel é ruim? • Linus Torvalds: perfomance sofrivel. • Experiencia pessoal