Silberschatz, Galvin and Gagne ©2007 Operating System Concepts with Java – 7 th Edition, Nov 15,...

53
Silberschatz, Galvin and Gagne ©2007 ating System Concepts with Java – 7 th Edition, Nov 15, 2006 Capitulo 2: Estruturas de Sistemas Operacionais

Transcript of Silberschatz, Galvin and Gagne ©2007 Operating System Concepts with Java – 7 th Edition, Nov 15,...

Page 1: Silberschatz, Galvin and Gagne ©2007 Operating System Concepts with Java – 7 th Edition, Nov 15, 2006 Capitulo 2: Estruturas de Sistemas Operacionais.

Silberschatz, Galvin and Gagne ©2007

Operating System Concepts with Java – 7th Edition, Nov 15, 2006

Capitulo 2: Estruturas de Sistemas Operacionais

Page 2: Silberschatz, Galvin and Gagne ©2007 Operating System Concepts with Java – 7 th Edition, Nov 15, 2006 Capitulo 2: Estruturas de Sistemas Operacionais.

2.2 Silberschatz, Galvin and Gagne ©2007

Operating System Concepts with Java – 7th Edition, Nov 15, 2006

Frase do Dia

“A ignorancia é vizinha da maldade”

Proverbio Arabe

Page 3: Silberschatz, Galvin and Gagne ©2007 Operating System Concepts with Java – 7 th Edition, Nov 15, 2006 Capitulo 2: Estruturas de Sistemas Operacionais.

2.3 Silberschatz, Galvin and Gagne ©2007

Operating System Concepts with Java – 7th Edition, Nov 15, 2006

Fique Ligado !

Neste mês, a Microsoft abandonou o plano de embutir o IE 8 ao novo sistema operacional Windows 7, devido à pressão da União Europeia. A Microsoft vai dar uma opção de que o usuário escolha o software que deseja instalar o IE 8 ou outro navegador de fabricantes diferentes.

O Google entrou no mercado dos browsers no último ano com o Chrome, que, de acordo com suspeitas dos analistas de mercado, deve ser distribuído com o novo sistema operacional, a ser lançado em 2010. “We designed Google Chrome for people who live on the web —

searching for information, checking email, catching up on the news, shopping or just staying in touch with friends. However, the operating systems that browsers run on were designed in an era where there was no web. So today, we're announcing a new project that's a natural extension of Google Chrome — the Google Chrome Operating System. It's our attempt to re-think what operating systems should be.” Google

Page 4: Silberschatz, Galvin and Gagne ©2007 Operating System Concepts with Java – 7 th Edition, Nov 15, 2006 Capitulo 2: Estruturas de Sistemas Operacionais.

2.4 Silberschatz, Galvin and Gagne ©2007

Operating System Concepts with Java – 7th Edition, Nov 15, 2006

Cap. 2 : Estruturas de SOs

Servicos de Sistemas Operacionais Interface do SO com Usuario Chamadas ao Sistema Tipos de Chamadas ao Sistema Programas do Sistema Projeto e Implementação do SO Estrutura do SO Maquinas Virtuais Geração do SO Inicio (boot) do Sistema

Page 5: Silberschatz, Galvin and Gagne ©2007 Operating System Concepts with Java – 7 th Edition, Nov 15, 2006 Capitulo 2: Estruturas de Sistemas Operacionais.

2.5 Silberschatz, Galvin and Gagne ©2007

Operating System Concepts with Java – 7th Edition, Nov 15, 2006

Objetivos

Descrever os serviços que um SO prove para os usuarios, processos e outros sistemas

Discutir as varias formas de estruturar um SO Explicar como sistema operacionais são

instalados e como eles iniciam (boot)

Page 6: Silberschatz, Galvin and Gagne ©2007 Operating System Concepts with Java – 7 th Edition, Nov 15, 2006 Capitulo 2: Estruturas de Sistemas Operacionais.

2.6 Silberschatz, Galvin and Gagne ©2007

Operating System Concepts with Java – 7th Edition, Nov 15, 2006

Serviços do Sistema Operacional

Um conjunto de serviços do SO prove funcoes que são úteis para o usuário: Interface com o usuario – A maioria dos sistemas operacionais tem uma

interface com o usuário (UI) Variam entre linha de comando (CLI), Interface Grafica com Usuario

(GUI) Varies between Command-Line (CLI), Batch (em lote) Execução de programas – O sistema deve permitir a carga de um

programa em memoria, executar este programa, e finalizar sua execução, tanto normalmente como de forma anormal (indicando erro)

Operacoes de E/S - Um programa em execução pode requisitar E/S, a qual pode involver um arquivo ou um dispositivo de E/S.

Manipulação do sistema de arquivos - O sistema de arquivo é de particular interesse. Obviamente, programas precisam ler e gravar arquivos e diretorios, criando e eliminando-os, procurando eles, apresentando informacoes sobre os mesmos e gerenciando suas permissoes.

Page 7: Silberschatz, Galvin and Gagne ©2007 Operating System Concepts with Java – 7 th Edition, Nov 15, 2006 Capitulo 2: Estruturas de Sistemas Operacionais.

2.7 Silberschatz, Galvin and Gagne ©2007

Operating System Concepts with Java – 7th Edition, Nov 15, 2006

Serviços do Sistema Operacional (Cont.)

Um conjunto de servicos do SO prove funcoes que sao uteis para o usuario (Cont): Comunicações – Processos podem trocar informações, no mesmo

computador ou através da rede Comunicação pode ser via memoria compartilhada or atraves

passagem de mensagens (pacotes movidos pelo SO) Detecção de erro – SO precisa estar consciente dos possiveis erros

Podem ocorrer na CPU e memoria, nos dispositivos de E/S, no programa do usuario

Para cada tipo de erro, o SO deve escolher a ação apropriada para garantir a computação correta e consistente

Facilidades de depuração podem ajudar bastante em enriquecer as habilidades dos usuarios e programadores no uso eficiente do sistema

Page 8: Silberschatz, Galvin and Gagne ©2007 Operating System Concepts with Java – 7 th Edition, Nov 15, 2006 Capitulo 2: Estruturas de Sistemas Operacionais.

2.8 Silberschatz, Galvin and Gagne ©2007

Operating System Concepts with Java – 7th Edition, Nov 15, 2006

Serviços do Sistema Operacional (Cont.)

Outro conjunto de funcoes do SO existem para garantir a operacao eficiente do proprio sistema via recurso compartilhado

Alocação de Recurso – Quando multiplos usuarios ou multiplos jobs executam concorretemente, recursos devem ser alocados para cada um deles

Varios tipos de recursos – Alguns (do tipo ciclo de CPU, memoria principal, e armazemento de arquivo) podem ter codigo de alocacao especial, outros (tais como dispositivos de E/S) podem ter codigo de requisicao e liberacao gerais.

Contabilidade – Para manter o rastro de quais usuarios usam o quanto e quais tipos de recursos do computador

Protecao e seguranca - Os donos da informacao armazenada em um computador multiusuario ou de rede, podem desejar controlar uso desta informacao, processos concorrentes nao podem interferir uns nos outros

Protecao – involve a garantia de que todos os acessos aos recursos do sistema sao controlados

Seguranca do sistema requer atenticacao do usuario, extendido para defesa dos dispositivos de E/S das tentativas de acesso invalido

Se um sistema deve ser protegido e seguro, preocacoes devem ser instituidas. Uma corrente é tao forte quanto seu elo mais fraco.

Page 9: Silberschatz, Galvin and Gagne ©2007 Operating System Concepts with Java – 7 th Edition, Nov 15, 2006 Capitulo 2: Estruturas de Sistemas Operacionais.

2.9 Silberschatz, Galvin and Gagne ©2007

Operating System Concepts with Java – 7th Edition, Nov 15, 2006

Interface do SO com o usuario - CLI

CLI (command line interface) permite entrada direta do usuario

Algumas vezes implementada no kernel, outras vezes pelos programas do sistema

Algumas vezes multiplos sabores sao implementados – shells

Primariamente recupera um comando do usuario e executa-o

Algumas vezes comandos embutidos, outras vezes apenas nomes de programas

No ultimo caso, a adicao de novas funcionalidades nao requer modificacao do shell

Page 10: Silberschatz, Galvin and Gagne ©2007 Operating System Concepts with Java – 7 th Edition, Nov 15, 2006 Capitulo 2: Estruturas de Sistemas Operacionais.

2.10 Silberschatz, Galvin and Gagne ©2007

Operating System Concepts with Java – 7th Edition, Nov 15, 2006

Interface do SO com o usuario - GUI

Interface que usa a metafora da area de trabalho (desktop) Usualmente mouse, teclado, e monitor Icones representam arquivos, programas, acoes, etc Varios butoes do mouse sobre objetos da interface

causam varias acoes (prove informacoes, opcoes, executa funcoes, abre arquivos (conhecido como pasta)

Inventado pela Xerox PARC Varios sistemas agora incluem tanto interfaces CLI como

interfaces GUI Microsoft Windows é GUI com CLI usando shell Apple Mac OS X usa interface GUI com kernel UNIX e

shells disponiveis Solaris é CLI com uso opcional de interfaces GUI (Java

Desktop, KDE)

Page 11: Silberschatz, Galvin and Gagne ©2007 Operating System Concepts with Java – 7 th Edition, Nov 15, 2006 Capitulo 2: Estruturas de Sistemas Operacionais.

2.11 Silberschatz, Galvin and Gagne ©2007

Operating System Concepts with Java – 7th Edition, Nov 15, 2006

Chamadas ao sistema

Interface de programação para serviços providos pelo SO Tipicamente escritas em uma linguagem de alto-nivel (C ou

C++) Em sua maioria acessadas por programas via uma

interface de aplicacao (API) de alto-nivel do que chamadas diretas ao sistema

As 3 mais conhecidas APIs sao: Win32 API para Windows, POSIX API para sistemas baseados em POSIX (incluindo todas as versoes do UNIX, Linux, e Mac OS X), e Java API para maquina virtual Java (JVM)

Por que usar APIs do que chamadas diretas ao sistema ?

(Note que nomes de chamadas ao sistema usadas ao longo deste texto sao genericas)

Page 12: Silberschatz, Galvin and Gagne ©2007 Operating System Concepts with Java – 7 th Edition, Nov 15, 2006 Capitulo 2: Estruturas de Sistemas Operacionais.

2.12 Silberschatz, Galvin and Gagne ©2007

Operating System Concepts with Java – 7th Edition, Nov 15, 2006

Page 13: Silberschatz, Galvin and Gagne ©2007 Operating System Concepts with Java – 7 th Edition, Nov 15, 2006 Capitulo 2: Estruturas de Sistemas Operacionais.

2.13 Silberschatz, Galvin and Gagne ©2007

Operating System Concepts with Java – 7th Edition, Nov 15, 2006

Exemplos de Chamadas ao Sistema

Sequencia de chamada ao sistema para copiar o conteudo de um arquivo para outro

Page 14: Silberschatz, Galvin and Gagne ©2007 Operating System Concepts with Java – 7 th Edition, Nov 15, 2006 Capitulo 2: Estruturas de Sistemas Operacionais.

2.14 Silberschatz, Galvin and Gagne ©2007

Operating System Concepts with Java – 7th Edition, Nov 15, 2006

Exemplo de uma API padrao

Considere a funcao read() do Java

byte[] b – o buffer no qual o dado é lido

int off – o offset inicial em b onde o dado é lido

int len – o numero maximo de bytes para ler

Page 15: Silberschatz, Galvin and Gagne ©2007 Operating System Concepts with Java – 7 th Edition, Nov 15, 2006 Capitulo 2: Estruturas de Sistemas Operacionais.

2.15 Silberschatz, Galvin and Gagne ©2007

Operating System Concepts with Java – 7th Edition, Nov 15, 2006

Implementacao de Chamada ao Sistema

Tipicamente, um numero associado com cada chamada ao sistema Interface de chamada ao sistema mantem uma tabela

indexada de acordo com esses numeros Uma interface de chamada ao sistema invoca chamada do

sistema no kernel do SO e retorna o estado da chamada e alguns valores de retorno

O chamador nao precisa saber sobre como a chamado ao sistema é implementada So precisa obdecer a API e entender o que o SO retornara

como resultado a chamada A maioria dos detalhes da interface do SO sao escondidas

do programador pela API Gerenciada pela bibioteca de suporte em tempo de

execucao (conjunto de funcoes incorporadas nas bibliotecas incluidas no compilador)

Page 16: Silberschatz, Galvin and Gagne ©2007 Operating System Concepts with Java – 7 th Edition, Nov 15, 2006 Capitulo 2: Estruturas de Sistemas Operacionais.

2.16 Silberschatz, Galvin and Gagne ©2007

Operating System Concepts with Java – 7th Edition, Nov 15, 2006

Relacionameno da API de chamadas ao sistema com SO

Page 17: Silberschatz, Galvin and Gagne ©2007 Operating System Concepts with Java – 7 th Edition, Nov 15, 2006 Capitulo 2: Estruturas de Sistemas Operacionais.

2.17 Silberschatz, Galvin and Gagne ©2007

Operating System Concepts with Java – 7th Edition, Nov 15, 2006

Exemplo da biblioteca padrao C

Programa C invocando printf(), o qual chama a system call write()

Page 18: Silberschatz, Galvin and Gagne ©2007 Operating System Concepts with Java – 7 th Edition, Nov 15, 2006 Capitulo 2: Estruturas de Sistemas Operacionais.

2.18 Silberschatz, Galvin and Gagne ©2007

Operating System Concepts with Java – 7th Edition, Nov 15, 2006

Passagem de parametro a System Call

Em geral, mais informacoes sao necessarias do que simplesmente a identidade da system call Tipo exato e quantidade de informacao variam de acordo com o

SO e a chamada Tres metodos usados para passar parametros para o SO

Mais simples: passando os parametros em registradores Em alguns casos, pode existir mais parametros do que

registradores Parametros armazenados em um bloco, ou tabela, em

memoria, e o endereco do bloco passado como parametro em um registrador

Esta abordagem é usada pelo Linux e Solaris Parametros colocado em uma pilha pelo programa e

recuperadas da pilha pelo SO Metodos de bloco e pilha nao limitam o numero e tamanho dos

parametros que estao sendo passados

Page 19: Silberschatz, Galvin and Gagne ©2007 Operating System Concepts with Java – 7 th Edition, Nov 15, 2006 Capitulo 2: Estruturas de Sistemas Operacionais.

2.19 Silberschatz, Galvin and Gagne ©2007

Operating System Concepts with Java – 7th Edition, Nov 15, 2006

Passagem de Parametro via Tabela

Page 20: Silberschatz, Galvin and Gagne ©2007 Operating System Concepts with Java – 7 th Edition, Nov 15, 2006 Capitulo 2: Estruturas de Sistemas Operacionais.

2.20 Silberschatz, Galvin and Gagne ©2007

Operating System Concepts with Java – 7th Edition, Nov 15, 2006

Tipos de System Calls

Controle de Processo Gerenciamento de Arquivo Gerenciamento de Dispositivo Manutencao de Informacao Comunicacoes

Page 21: Silberschatz, Galvin and Gagne ©2007 Operating System Concepts with Java – 7 th Edition, Nov 15, 2006 Capitulo 2: Estruturas de Sistemas Operacionais.

2.21 Silberschatz, Galvin and Gagne ©2007

Operating System Concepts with Java – 7th Edition, Nov 15, 2006

Execucao MS-DOS

(a) At system startup (b) running a program

Page 22: Silberschatz, Galvin and Gagne ©2007 Operating System Concepts with Java – 7 th Edition, Nov 15, 2006 Capitulo 2: Estruturas de Sistemas Operacionais.

2.22 Silberschatz, Galvin and Gagne ©2007

Operating System Concepts with Java – 7th Edition, Nov 15, 2006

FreeBSD Executando Multiplos Programas

Page 23: Silberschatz, Galvin and Gagne ©2007 Operating System Concepts with Java – 7 th Edition, Nov 15, 2006 Capitulo 2: Estruturas de Sistemas Operacionais.

2.23 Silberschatz, Galvin and Gagne ©2007

Operating System Concepts with Java – 7th Edition, Nov 15, 2006

Programas do Sistema

Provem um ambiente conveniente para desenvolvimento e execucao de programas. Eles podem ser divididos em: Manipulacao de Arquivo Informacao sobre estado Modificacao de Arquivo Suporte a linguagem de programacao Carga e execucao de programa Comunicacoes Programas de Aplicacao

A maior parte da visao dos usuarios sobre o SO é definida pelos programas do sistema, nao sobre as system calls

Page 24: Silberschatz, Galvin and Gagne ©2007 Operating System Concepts with Java – 7 th Edition, Nov 15, 2006 Capitulo 2: Estruturas de Sistemas Operacionais.

2.24 Silberschatz, Galvin and Gagne ©2007

Operating System Concepts with Java – 7th Edition, Nov 15, 2006

Solaris 10 dtrace rastreando System Call

Page 25: Silberschatz, Galvin and Gagne ©2007 Operating System Concepts with Java – 7 th Edition, Nov 15, 2006 Capitulo 2: Estruturas de Sistemas Operacionais.

2.25 Silberschatz, Galvin and Gagne ©2007

Operating System Concepts with Java – 7th Edition, Nov 15, 2006

Programas do Sistema

Provem um ambiente conveniente para desenvolvimento e execucao de programas. Alguns deles sao simples interfaces com usuario para as system

calls; outros sao consideravelmente mais complexos Gerenciamento de arquivos – criar, eliminar, copiar, renomear,

imprimir, dump, listar, e geralmente manipular arquivos e diretorios Informacao de estado

Alguem pergunta sobre uma informacao – data, hora, memoria disponivel, espaco em disco, numero de usuarios

Outros provem informacoes detalhadas sobre performance, logging, e depuracao

Tipicamente, esses programas formatam e imprimem a saida para terminal ou outros dispositivos de saida

Alguns sistemas implementam um registry – usado para armazenar e recuperar informacao sobre configuracao

Page 26: Silberschatz, Galvin and Gagne ©2007 Operating System Concepts with Java – 7 th Edition, Nov 15, 2006 Capitulo 2: Estruturas de Sistemas Operacionais.

2.26 Silberschatz, Galvin and Gagne ©2007

Operating System Concepts with Java – 7th Edition, Nov 15, 2006

Programas do Sistema (cont)

Modificacao de Arquivo Editores de texto para criar e modificar arquivos Comandos especiais para pesquisar conteudo dos arquivos ou

para executar transformacoes no texto Suporte a linguagem de programacao – Compiladores, assemblers,

debuggers, e interpretadores algumas vezes sao providos Carga e execucao de programas – Carregadores absolutos,

carreadores realocaveis, editores de linkage, e carregadores de overlay, sistemas de depuracao para alto-nivel e linguagem de maquina

Comunicacoes – Prover os mecanismos para criacao virtual de conecoes entre processos, usuarios, e sistemas de computador Permite usuarios enviar mensagens para outra telas, navega

em paginas web, enviar email eletronico, logar remotamente, transferir dados de uma maquina para outra

Page 27: Silberschatz, Galvin and Gagne ©2007 Operating System Concepts with Java – 7 th Edition, Nov 15, 2006 Capitulo 2: Estruturas de Sistemas Operacionais.

2.27 Silberschatz, Galvin and Gagne ©2007

Operating System Concepts with Java – 7th Edition, Nov 15, 2006

Page 28: Silberschatz, Galvin and Gagne ©2007 Operating System Concepts with Java – 7 th Edition, Nov 15, 2006 Capitulo 2: Estruturas de Sistemas Operacionais.

2.28 Silberschatz, Galvin and Gagne ©2007

Operating System Concepts with Java – 7th Edition, Nov 15, 2006

Operating System Design and Implementation

Design and Implementation of OS not “solvable”, but some approaches have proven successful

Internal structure of different Operating Systems can vary widely

Start by defining goals and specifications Affected by choice of hardware, type of system User goals and System goals

User goals – operating system should be convenient to use, easy to learn, reliable, safe, and fast

System goals – operating system should be easy to design, implement, and maintain, as well as flexible, reliable, error-free, and efficient

Page 29: Silberschatz, Galvin and Gagne ©2007 Operating System Concepts with Java – 7 th Edition, Nov 15, 2006 Capitulo 2: Estruturas de Sistemas Operacionais.

2.29 Silberschatz, Galvin and Gagne ©2007

Operating System Concepts with Java – 7th Edition, Nov 15, 2006

Operating System Design and Implementation (Cont.)

Important principle to separate

Policy: What will be done? Mechanism: How to do it?

Mechanisms determine how to do something, policies decide what will be done The separation of policy from mechanism is a

very important principle, it allows maximum flexibility if policy decisions are to be changed later

Page 30: Silberschatz, Galvin and Gagne ©2007 Operating System Concepts with Java – 7 th Edition, Nov 15, 2006 Capitulo 2: Estruturas de Sistemas Operacionais.

2.30 Silberschatz, Galvin and Gagne ©2007

Operating System Concepts with Java – 7th Edition, Nov 15, 2006

Simple Structure

MS-DOS – written to provide the most functionality in the least space Not divided into modules Although MS-DOS has some structure, its

interfaces and levels of functionality are not well separated

Page 31: Silberschatz, Galvin and Gagne ©2007 Operating System Concepts with Java – 7 th Edition, Nov 15, 2006 Capitulo 2: Estruturas de Sistemas Operacionais.

2.31 Silberschatz, Galvin and Gagne ©2007

Operating System Concepts with Java – 7th Edition, Nov 15, 2006

MS-DOS Layer Structure

Page 32: Silberschatz, Galvin and Gagne ©2007 Operating System Concepts with Java – 7 th Edition, Nov 15, 2006 Capitulo 2: Estruturas de Sistemas Operacionais.

2.32 Silberschatz, Galvin and Gagne ©2007

Operating System Concepts with Java – 7th Edition, Nov 15, 2006

Layered Approach

The operating system is divided into a number of layers (levels), each built on top of lower layers. The bottom layer (layer 0), is the hardware; the highest (layer N) is the user interface.

With modularity, layers are selected such that each uses functions (operations) and services of only lower-level layers

Page 33: Silberschatz, Galvin and Gagne ©2007 Operating System Concepts with Java – 7 th Edition, Nov 15, 2006 Capitulo 2: Estruturas de Sistemas Operacionais.

2.33 Silberschatz, Galvin and Gagne ©2007

Operating System Concepts with Java – 7th Edition, Nov 15, 2006

Layered Operating System

Page 34: Silberschatz, Galvin and Gagne ©2007 Operating System Concepts with Java – 7 th Edition, Nov 15, 2006 Capitulo 2: Estruturas de Sistemas Operacionais.

2.34 Silberschatz, Galvin and Gagne ©2007

Operating System Concepts with Java – 7th Edition, Nov 15, 2006

UNIX

UNIX – limited by hardware functionality, the original UNIX operating system had limited structuring. The UNIX OS consists of two separable parts Systems programs The kernel

Consists of everything below the system-call interface and above the physical hardware

Provides the file system, CPU scheduling, memory management, and other operating-system functions; a large number of functions for one level

Page 35: Silberschatz, Galvin and Gagne ©2007 Operating System Concepts with Java – 7 th Edition, Nov 15, 2006 Capitulo 2: Estruturas de Sistemas Operacionais.

2.35 Silberschatz, Galvin and Gagne ©2007

Operating System Concepts with Java – 7th Edition, Nov 15, 2006

UNIX System Structure

Page 36: Silberschatz, Galvin and Gagne ©2007 Operating System Concepts with Java – 7 th Edition, Nov 15, 2006 Capitulo 2: Estruturas de Sistemas Operacionais.

2.36 Silberschatz, Galvin and Gagne ©2007

Operating System Concepts with Java – 7th Edition, Nov 15, 2006

Microkernel System Structure

Moves as much from the kernel into “user” space Communication takes place between user modules using

message passing Benefits:

Easier to extend a microkernel Easier to port the operating system to new architectures More reliable (less code is running in kernel mode) More secure

Detriments: Performance overhead of user space to kernel space

communication

Page 37: Silberschatz, Galvin and Gagne ©2007 Operating System Concepts with Java – 7 th Edition, Nov 15, 2006 Capitulo 2: Estruturas de Sistemas Operacionais.

2.37 Silberschatz, Galvin and Gagne ©2007

Operating System Concepts with Java – 7th Edition, Nov 15, 2006

Mac OS X Structure

Page 38: Silberschatz, Galvin and Gagne ©2007 Operating System Concepts with Java – 7 th Edition, Nov 15, 2006 Capitulo 2: Estruturas de Sistemas Operacionais.

2.38 Silberschatz, Galvin and Gagne ©2007

Operating System Concepts with Java – 7th Edition, Nov 15, 2006

Modules

Most modern operating systems implement kernel modules Uses object-oriented approach Each core component is separate Each talks to the others over known interfaces Each is loadable as needed within the kernel

Overall, similar to layers but with more flexible

Page 39: Silberschatz, Galvin and Gagne ©2007 Operating System Concepts with Java – 7 th Edition, Nov 15, 2006 Capitulo 2: Estruturas de Sistemas Operacionais.

2.39 Silberschatz, Galvin and Gagne ©2007

Operating System Concepts with Java – 7th Edition, Nov 15, 2006

Solaris Modular Approach

Page 40: Silberschatz, Galvin and Gagne ©2007 Operating System Concepts with Java – 7 th Edition, Nov 15, 2006 Capitulo 2: Estruturas de Sistemas Operacionais.

2.40 Silberschatz, Galvin and Gagne ©2007

Operating System Concepts with Java – 7th Edition, Nov 15, 2006

Virtual Machines

A virtual machine takes the layered approach to its logical conclusion. It treats hardware and the operating system kernel as though they were all hardware

A virtual machine provides an interface identical to the underlying bare hardware

The operating system creates the illusion of multiple processes, each executing on its own processor with its own (virtual) memory

Page 41: Silberschatz, Galvin and Gagne ©2007 Operating System Concepts with Java – 7 th Edition, Nov 15, 2006 Capitulo 2: Estruturas de Sistemas Operacionais.

2.41 Silberschatz, Galvin and Gagne ©2007

Operating System Concepts with Java – 7th Edition, Nov 15, 2006

Virtual Machines (Cont.)

The resources of the physical computer are shared to create the virtual machines CPU scheduling can create the appearance that

users have their own processor Spooling and a file system can provide virtual

card readers and virtual line printers A normal user time-sharing terminal serves as

the virtual machine operator’s console

Page 42: Silberschatz, Galvin and Gagne ©2007 Operating System Concepts with Java – 7 th Edition, Nov 15, 2006 Capitulo 2: Estruturas de Sistemas Operacionais.

2.42 Silberschatz, Galvin and Gagne ©2007

Operating System Concepts with Java – 7th Edition, Nov 15, 2006

Virtual Machines (Cont.)

(a)

Non-virtual Machine Virtual Machine

Page 43: Silberschatz, Galvin and Gagne ©2007 Operating System Concepts with Java – 7 th Edition, Nov 15, 2006 Capitulo 2: Estruturas de Sistemas Operacionais.

2.43 Silberschatz, Galvin and Gagne ©2007

Operating System Concepts with Java – 7th Edition, Nov 15, 2006

Virtual Machines (Cont.)

The virtual-machine concept provides complete protection of system resources since each virtual machine is isolated from all other virtual machines. This isolation, however, permits no direct sharing of resources.

A virtual-machine system is a perfect vehicle for operating-systems research and development. System development is done on the virtual machine, instead of on a physical machine and so does not disrupt normal system operation.

The virtual machine concept is difficult to implement due to the effort required to provide an exact duplicate to the underlying machine

Page 44: Silberschatz, Galvin and Gagne ©2007 Operating System Concepts with Java – 7 th Edition, Nov 15, 2006 Capitulo 2: Estruturas de Sistemas Operacionais.

2.44 Silberschatz, Galvin and Gagne ©2007

Operating System Concepts with Java – 7th Edition, Nov 15, 2006

VMware Architecture

Page 45: Silberschatz, Galvin and Gagne ©2007 Operating System Concepts with Java – 7 th Edition, Nov 15, 2006 Capitulo 2: Estruturas de Sistemas Operacionais.

2.45 Silberschatz, Galvin and Gagne ©2007

Operating System Concepts with Java – 7th Edition, Nov 15, 2006

Page 46: Silberschatz, Galvin and Gagne ©2007 Operating System Concepts with Java – 7 th Edition, Nov 15, 2006 Capitulo 2: Estruturas de Sistemas Operacionais.

2.46 Silberschatz, Galvin and Gagne ©2007

Operating System Concepts with Java – 7th Edition, Nov 15, 2006

Java

Java consists of

1. Programming language specification

2. Application programming interface (API)

3. Virtual machine specification

Page 47: Silberschatz, Galvin and Gagne ©2007 Operating System Concepts with Java – 7 th Edition, Nov 15, 2006 Capitulo 2: Estruturas de Sistemas Operacionais.

2.47 Silberschatz, Galvin and Gagne ©2007

Operating System Concepts with Java – 7th Edition, Nov 15, 2006

The Java Virtual Machine

Page 48: Silberschatz, Galvin and Gagne ©2007 Operating System Concepts with Java – 7 th Edition, Nov 15, 2006 Capitulo 2: Estruturas de Sistemas Operacionais.

2.48 Silberschatz, Galvin and Gagne ©2007

Operating System Concepts with Java – 7th Edition, Nov 15, 2006

The Java Virtual Machine

Java portability across platforms.

Page 49: Silberschatz, Galvin and Gagne ©2007 Operating System Concepts with Java – 7 th Edition, Nov 15, 2006 Capitulo 2: Estruturas de Sistemas Operacionais.

2.49 Silberschatz, Galvin and Gagne ©2007

Operating System Concepts with Java – 7th Edition, Nov 15, 2006

The Java Development Environment

Page 50: Silberschatz, Galvin and Gagne ©2007 Operating System Concepts with Java – 7 th Edition, Nov 15, 2006 Capitulo 2: Estruturas de Sistemas Operacionais.

2.50 Silberschatz, Galvin and Gagne ©2007

Operating System Concepts with Java – 7th Edition, Nov 15, 2006

Java Operating Systems

The JX operating system

Page 51: Silberschatz, Galvin and Gagne ©2007 Operating System Concepts with Java – 7 th Edition, Nov 15, 2006 Capitulo 2: Estruturas de Sistemas Operacionais.

2.51 Silberschatz, Galvin and Gagne ©2007

Operating System Concepts with Java – 7th Edition, Nov 15, 2006

Operating System Generation

Operating systems are designed to run on any of a class of machines; the system must be configured for each specific computer site

SYSGEN program obtains information concerning the specific configuration of the hardware system

Booting – starting a computer by loading the kernel

Bootstrap program – code stored in ROM that is able to locate the kernel, load it into memory, and start its execution

Page 52: Silberschatz, Galvin and Gagne ©2007 Operating System Concepts with Java – 7 th Edition, Nov 15, 2006 Capitulo 2: Estruturas de Sistemas Operacionais.

2.52 Silberschatz, Galvin and Gagne ©2007

Operating System Concepts with Java – 7th Edition, Nov 15, 2006

System Boot

Operating system must be made available to hardware so hardware can start it Small piece of code – bootstrap loader,

locates the kernel, loads it into memory, and starts it

Sometimes two-step process where boot block at fixed location loads bootstrap loader

When power initialized on system, execution starts at a fixed memory location

Firmware used to hold initial boot code

Page 53: Silberschatz, Galvin and Gagne ©2007 Operating System Concepts with Java – 7 th Edition, Nov 15, 2006 Capitulo 2: Estruturas de Sistemas Operacionais.

Silberschatz, Galvin and Gagne ©2007

Operating System Concepts with Java – 7th Edition, Nov 15, 2006

End of Chapter 2