Download 3장 - 성미영 교수님 홈페이지

Document related concepts
no text concepts found
Transcript
Chapter 2. 시스템 구조(System Structures)
• Questions of the day
1. 운영체제에서 매개변수를 전달하는 일반적인 방법
3가지는 무엇인가요?
2. 운영체제 설계자가 가상기계 구조를 사용하는 것의
주요 장점은 무엇인가요?
• Services in 3 Views
» Users : OS서비스
» Programmers : OS의 인터페이스 (system call)
» OS designers : 구성 요소와 그들의 상호 연결
(component and interconnections)
운영체제
2.1
인천대학교 컴퓨터공학과 성미영
Chapter 2. 시스템 구조(System Structures)
1. 운영체제 서비스(Operating-System Services)
2. 사용자 운영체제 인터페이스(User Operating-System Interface)
3. 시스템 호출(System Calls)
4. 시스템 호출의 유형 (Types of System Calls)
5. 시스템 프로그래밍 (System Programs)
6. 운영체제 설계 및 구현(Operating-System Design and Implementation)
7. 운영체제 구조(Operating-System Structure)
8. 가상 기계(Virtual Machines)
9. 운영체제 생성(Operating-System Generation)
10. 시스템 부트(System Boot)
운영체제
2.2
인천대학교 컴퓨터공학과 성미영
시스템 구성 (System Components)
• 프로세스 관리(Process Management)
» 프로세스 : 실행중인 프로그램(program in execution)
• 프로세스 : active entity : PC(program counter)가 있는 프로그램
• 프로그램 : passive entity: 디스크상의 파일 내용
» 하는 일
• 프로세스의 생성 / 삭제(creation / deletion)
• 프로세스의 중지 / 재수행(suspension / resumption)
• 프로세스의 동기화(process synchronization)
• 프로세스의 통신(process communication)
• 교착상태 방지와 회복(deadlock handling)
운영체제
2.3
인천대학교 컴퓨터공학과 성미영
시스템 구성 (System Components)
•
주기억장치(메모리) 관리(Main-Memory Management)
» 하는 일
• 사용 가능한 부분 파악
• 적재할 프로세스 결정
• 필요공간의 할당과 회수
•
보조기억 장치 관리(Secondary-Storage Management)
» 하는 일
• 비어 있는 공간 관리(free-space management)
• 저장 장소 할당(storage allocation)
• 디스크 스케줄링(disk scheduling)
•
운영체제
화일 관리(File Management)
» 하는 일
• 파일의 생성과 삭제
• 디렉토리의 생성/삭제
• 파일과 디렉토리를 관리하기 위한 프리미티브(기본기능)제공
• 보조기억장치에 있는 파일의 사상(mapping)
• 파일 저장
2.4
인천대학교 컴퓨터공학과 성미영
시스템 구성 (System Components)
운영체제
•
입출력 시스템 관리(I/O System Management)
» 하는 일
• 임시저장(buffer-caching)시스템: buffering, caching, spooling
• 일반적인 장치구동기 인터페이스
• 특정 하드웨어 장치들을 위한 구동기
•
네트워킹(Networking)
» 분산시스템 : memory와 cache를 공유하지 않는 프로세서들이
통신네트워크로 연결된 시스템(high-speed bus나 전화선을 통해
통신)
» 설계시 고려사항
• 경로 설정(routing) 정책
• 접속(connection) 정책
• 충돌(contention) 문제
• 보안(security) 문제
» network access : file access 의 확장
• network interface를 위한 device driver를 이용
2.5
인천대학교 컴퓨터공학과 성미영
시스템 구성 (System Components)
운영체제
•
보호 시스템(Protection System)
» 컴퓨터에 의해 정의된 자원들에 대한 프로그램, 프로세스, 사용자들의 사용 권한
접근을 제어하는 기법이 필요
» (예) base와 limit registers for user’s own address space
•
명령 해석기 시스템(Command-Interpreter System)
» command interpreter
• 다음 명령문 받아 실행
» control-card interpreter
» command-line interpreter: command.com
» shell
• user과 OS사이의 interface로서 다음 명령을 받아 실행 (프로세스 관리~보호)
• 위치
» Kernel 안에: 항상 존재(MS-DOS의 내부 명령)
» 보조기억 장치에: 필요할 때만 실행(MS-DOS의 외부 명령, Unix)
» 형태
• user friendly GUI(Graphical User Interface): Macintosh의 mouse-based,
icon-based
• sophisticated user는 복잡하고 배우기 어려워도 Unix shells 같은 강력한 명령
해석기 선호
2.6
인천대학교 컴퓨터공학과 성미영
Bourne Shell Command Interpreter
2.7
인천대학교 컴퓨터공학과 성미영
The Mac OS X GUI
2.8
인천대학교 컴퓨터공학과 성미영
운영체제 서비스 (Operating-System Services)
•
•
•
•
프로그램 수행(programs execution)
•
•
•
•
오류 탐지(error detection): I/O, memory, network, program errors
•
운영체제
입출력 작업(I/O operation): file I/O, device I/O
파일 시스템 조작: read/write/create/delete files
통신(communication)
» in the same system  shared memory
» in the different system  message passing
자원 할당(resource allocation): multiusers, multiprogramming
회계(accounting): usage statistics
보호(protection)
» 보호(protection) : 정보보호, process보호, 자원보호, 시스템 보호
» 보안(security) : password
OS services 제공 방법:
» system calls : assembly language  high-level language
» system programming
2.9
인천대학교 컴퓨터공학과 성미영
시스템 호출 (System Calls)
•
Process  OS의 기능
system calls
•
고급언어로 직접 호출 : C, Bliss, BCPL, PL/360
(예) fd = open(“file”, 0);
0: r, 1: w, 3:rw
nread = read(fd, buf, n);
•
시스템 호출에 필요한 파라미터 전달
1. 레지스터 전달  fastcall
2. 파라미터 블록 또는 테이블의 주소를 전달 (그림 2.4)
3. 스택으로 전달  asmlinkage
#define fastcall __attribute__((regparm(3)))
#define asmlinkage CPP_ASMLINKAGE __attribute__((regparm(0)))
운영체제
2.10
인천대학교 컴퓨터공학과 성미영
Table로 매개변수 전달
운영체제
2.11
인천대학교 컴퓨터공학과 성미영
시스템 호출 과정
main
{
…
syscall
(__NR_newsyscall);
}
ENTRY(system_call) /*arch/x86/kernel/entry_32.S 496*/
SAVE_ALL
….
call *sys_call_table(,%eax,4)
….
IDT(IVT)
0x0 divide_error()
degug()
nmi()
ENTRY(sys_call_table) /*arch/x86/kernel/syscall_table_32.S*/
…
…
syscall()
{
…
movl 338, %eax
int $0x80
…
}
…
0x80 system_call()
…
0
sys_restart_syscall()
1
sys_exit()
2
sys_fork()
3
sys_read()
4
sys_write()
338
IDT: Interrupt Descriptor Table
= IVT: Interrrupt Vector Table
/*real handler*/
asmlinkage int sys_newsyscall()
{
printk(…);
}
sys_newsyscall()
/usr/include/asm/unistd_32.h
/usr/src/kernels/linux-2.6.38.6/arch/x86/include/asm/unistd_32.h
2.12
인천대학교 컴퓨터공학과 성미영
Lab 1. Example of System Calls
• System call sequence to copy the contents of one file to another file
$ mycp a b
운영체제
2.13
인천대학교 컴퓨터공학과 성미영
Lab 1. 시스템 호출을 이용하는 mycp.c
1. mycphint1.c & mycphint2.c coding & compile & run
2. 제출 방법 (집에서도 접속 가능합니다)
» 2 Electronic versions:
• multi.incheon.ac.kr (117.16.244.53)의 지정 디렉토리
/export/home/os2011hwa 또는 os2011hwb 에 자기
학번의 디렉토리 만들고 그 곳에 소스파일과 실행파일
복사
• mylinux.incheon.ac.kr (117.16.244.59) 지정 디렉토리
/home/os2011hwa 또는 os2011hwb 에 자기 학번의
디렉토리 만들고 그 곳에 소스파일과 실행파일 복사
운영체제
2.14
인천대학교 컴퓨터공학과 성미영
(Hint 1: mycphint1.c) 과제 2-2 연습문제 2.18
운영체제
#include <stdio.h>
#include <unistd.h>
#define NAME_LENGTH 25
int main(void)
{
char in_file[NAME_LENGTH], out_file[NAME_LENGTH];
FILE *in, *out;
int c;
printf("Enter source file name: ");
scanf("%s",in_file);
printf("Enter destination file name: ");
scanf("%s",out_file);
if ( (in = fopen(in_file,"r")) == NULL) {
fprintf(stderr,"Cannot open %s for reading\n",in_file);
return -1;
}
if ( (out = fopen(out_file,"w")) == NULL) {
fprintf(stderr,"Cannot open %s for writing\n",out_file);
return -1;
}
while ( (c = getc(in)) != EOF)
putc(c,out);
fclose(in);
fclose(out);
}
2.15
인천대학교 컴퓨터공학과 성미영
3/28야
(Hint 2: mycphint2.c) 과제 2-2 연습문제 2.18
#include <stdio.h>
#include <stdlib.h>
수정1: include
수정2: permission
수정3: truncate
#define PERMS 0644
char *progname;
main(int argc, char *argv[])
{
int f1, f2, n;
char buf[BUFSIZ];
if (argc != 3)
printf("Usage: %s a b\n", progname);
if ((f1 = open(argv[1], O_RDONLY, 0)) == -1)
printf("can't open %s\n", argv[1]);
if ((f2 = open(argv[2], O_RDWR|O_CREAT|O_APPEND
)) == -1)
printf("can't creat %s\n", argv[2]);
while ((n = read(f1, buf, BUFSIZ)) > 0)
if (write(f2, buf, n) != n)
printf("write errono");
exit(0);
운영체제
}
2.16
인천대학교 컴퓨터공학과 성미영
Example of Standard API
운영체제
•
•
Consider the ReadFile() function in the
•
A description of the parameters passed to ReadFile()
» HANDLE file—the file to be read
» LPVOID buffer—a buffer where the data will be read into and written from
» DWORD bytesToRead—the number of bytes to be read into the buffer
» LPDWORD bytesRead—the number of bytes read during the last read
» LPOVERLAPPED ovl—indicates if overlapped I/O is being used
Win32 API—a function for reading from a file
2.17
인천대학교 컴퓨터공학과 성미영
API – System Call – OS Relationship
운영체제
2.18
인천대학교 컴퓨터공학과 성미영
Standard C Library Example
• C program invoking printf() library call, which calls write() system call
운영체제
2.19
인천대학교 컴퓨터공학과 성미영
Solaris 10 dtrace Following System Call
운영체제
2.20
인천대학교 컴퓨터공학과 성미영
시스템 호출 5개 그룹
» Unix: /usr/include/sys/syscall.h
» Linux: /usr/include/asm/unistd_32.h
① 프로세스 제어(process control)
② 화일 관리(file manipulation)
③ 장치 관리(device manipulation)
④ 정보 유지 보수(information maintenance)
⑤ 통신(communication)
⑥ 보호(protection)
운영체제
2.21
인천대학교 컴퓨터공학과 성미영
Examples of Windows and Unix System Calls
2.22
인천대학교 컴퓨터공학과 성미영
시스템 호출 유형 (5개 그룹)
① 프로세스와 작업 제어(Process and Job Control)
운영체제
» 작업제어를 위한 시스템 호출들
• 프로세스 제어(load, execute)  ld, exec
• 프로세스 생성(create process or submit job)  fork, vfork, __clone
• 프로세스 속성 획득과 설정(get process attribute and set process
attribute)  getpid, setpid, getpgrp, setpgrp
• 프로세스 종료(terminate process)  exit, abort
• 시간대기(wait time)  sleep, pause
• 사건대기(wait event)  wait, pause
• 사건신호(signal event)  kill
• 기억장치 할당 및 해제  malloc, free
» 디버깅을 위한 시스템 호출들  od, dump, dtrace, ptrace
» 시간 프로필(time profile): 특정 부분 수행 시간의 양 추적  time
» 프로세스 실행 비교(그림 2.7, 그림 2.8)
• single-tasking system MS-DOS: 새 프로세스 생성 없음
» TSR (Terminate and Stay Resident) 프로그램
• 제한적 동시수행: hooks an interrupt 후 TSR system call과
함께 exit: 자신의 subroutine을 interrupt routine으로 설정하여
interrupt를 가로챔
• TSR system call: MS-DOS가 덮어쓰지 못하게 함
• multitasking system UNIX: fork로 새 프로세스 생성  fork + exec
2.23
인천대학교 컴퓨터공학과 성미영
MS-DOS 실행
At System Start-up
운영체제
Running a Program
2.24
인천대학교 컴퓨터공학과 성미영
FreeBSD 다중 프로그램 수행
운영체제
2.25
인천대학교 컴퓨터공학과 성미영
시스템 호출 5개 그룹
② 화일 관리(File Manipulation)
» 생성(create)  creat
» 삭제(delete)  unlink
» 열기(open), 읽기(read), 쓰기(write), 재위치(reposition), 닫기(close) 
open, read, write, lseek, close
» 화일 속성 획득과 설정(get file attribute and set file attribute)  fcntl
③ 장치관리(Device Management)
» 요구(request)  ioctl, mount
» 열기/닫기(open/close)  open, close
» 읽기/쓰기(read/write)  read, write
» 재위치(reposition)  ioctl, lseek
④ 정보 유지관리(information maintenance)
» time  time
» date  (syscall) gettimeofday, settimeofday, (shell) date
» 사용가능 memory 크기 등  (syscall) getrusage, quotactl (shell) du, df,
quotacheck
운영체제
2.26
인천대학교 컴퓨터공학과 성미영
시스템 호출 5개 그룹
⑤ 통신(Communication)
» 메시지 전송 모델(message-passing model )
• get hostid, get processid  gethostname, getpid
• open connection, close connection  socket, connect, close
• read message, write message  read, write
• daemon(accept connection)  accept
» 공유 기억장치 모델(shared-memory model)
• 다른 프로세스에 소유된 기억 장소에 대한 접근을 위한 것
• map memory  shmget, shmat, shmdt, shmctl
⑥ 보호(protection)
운영체제
2.27
인천대학교 컴퓨터공학과 성미영
통신 모델 (Communication Models)
Msg Passing
Shared Memory
차이점?
운영체제
2.28
인천대학교 컴퓨터공학과 성미영
시스템 프로그램 (System Programs)
•
시스템 프로그램의 종류
» 파일 조작: create, delete, copy, rename, print, dump, list..
» 상태 정보: date, time, memory...
» 파일 수정: text editors
» 프로그래밍 언어 지원: compilers, assemblers, interpreters
» 프로그램 적재와 수행: absolute loader, relocatable loaders, linkage
editors, overlay loader, debugging tool
» 통신:e-mail, remote login, telnet
•
명령 해석기: 가장 중요한 시스템 프로그램
» 자체가 실행 코드 가짐: MS-DOS의 command.com
• 명령 첨가하면 재 컴파일
» 실행될 파일 인식 그것에 매개변수 전달: Unix
• (예) delete G: delete 실행 파일 적재 후 실행
• 작고 새 명령 첨가 쉬움
$ man builtins
$ ls /bin /sbin | wc -w
운영체제
2.29
인천대학교 컴퓨터공학과 성미영
시스템 구조 (System Structure)
① 간단한 구조 (Simple Structure)
» MS-DOS (Microsoft Disc Operating System)
• 최소의 메모리 공간 최대 기능
• 덜 모듈화
• ROM BIOS (Read Only Memory Basic Input Output System) 직접
이용: low level 기능 직접 접근으로 전체 시스템 crashes 가능
• 하드웨어 보호 없음: dual mode 없음 (Intel 8088 has no mode bit)
» 초기 UNIX
• 구성
» Kernel: bulky
» Systems programs
• Kernel의 분할과 축소
» Mach (microkernel: small set of necessary primitives)
» AIX (Advanced Interactive eXecutive) : 2 kernel part
• System Call : programmer interface
• Shell : user interface
운영체제
2.30
인천대학교 컴퓨터공학과 성미영
MS-DOS 계층 구조
운영체제
2.31
인천대학교 컴퓨터공학과 성미영
UNIX 시스템 구조
운영체제
2.32
인천대학교 컴퓨터공학과 성미영
시스템 구조 (System Structure)
② 계층적 접근(Layered Approach)
» modular operating system (모듈화된 운영체제)
• 강력한 제어
• 내부 시스템 변경의 자유로움
• 정보 은폐(information hiding)
• 각 운영체제 계층 = 추상 객체(abstract object) 구현: 자료가
캡슐화(encapsulation)된 것
• 자신보다 하위 계층에 의해 제공되는 연산들만 사용
» 장점
• modularity
• debugging쉽고 verification쉽다.
» 단점
• 비효율적
• 처리시간 overhead(일련의 trap의 연속)
» (예)
• THE(Technische Hogeschool Eindhoven) 계층 구조
• Venus 계층 구조
• OS/2 계층 구조: multitasking, dual-mode, MS-DOS 보다 더 계층화 됨
• Windows NT: highly layered  성능 향상 위해 사용자 영역의 계층들을
kernel로 흡수
» 추세: 모듈화 그러나 계층은 적게
운영체제
2.33
인천대학교 컴퓨터공학과 성미영
Layered Operating System
운영체제
2.34
인천대학교 컴퓨터공학과 성미영
OS/2 계층 구조
운영체제
2.35
인천대학교 컴퓨터공학과 성미영
시스템 구조 (System Structure)
③ 마이크로커널 (Microkernel)
» Mach (CMU; Carnegie Mellon University)
• microkernel approach
» essential  kernel
» nonessential  system and user-level programs
• client와 server는 microkernel에게 message passing하여 교신
• 새로운 서비스 추가되어도 kernel 수정 거의 없음
• 이식성(portability), 보안성(security), 신뢰성(reliability) 좋음
» Digital Unix (OSF/1)
• Unix interface
• Mach kernel로 구현됨
» Unix system call을 사용자 수준 서비스에 대한 message들로 연결
» Apple Mac OS X Server
• Mach kernel 기반
» Windows NT
• layered approach
• 다양한 응용 (Win32, OS/2, POSIX) 실행 가능
• user space에서 server 및 client 프로그램 실행
• kernel이 client와 server 사이의 message passing 중재
운영체제
2.36
인천대학교 컴퓨터공학과 성미영
시스템 구조 (System Structure)
④ 모듈 (Modules)
» 동적 적재 커널 모듈 (dynamically loadable kernel modules)
• Scheduling classes
• File systems
• Loadable system calls
• Executable formats
• STREAMS modules
• Miscellaneous
• Device and bus drivers
» Unix, such as Solaris
» Linux
» Mac OS X (Darwin)
• 혼합 구조 (hybrid structure) (Mach + BSD)
» Mach microkernel: RPC (remote procedure calls), IPC
(interprocess communication)
» BSD kernel: BSD command line interface (POSIX APIs)
• device drivers 개발 위한 I/O kit 제공
• 동적 적재 모듈 (dynamically loadable modules) 지원 (kernel
extensions)
운영체제
2.37
인천대학교 컴퓨터공학과 성미영
Solaris Modular Approach
운영체제
2.38
인천대학교 컴퓨터공학과 성미영
Mac OS X Structure
운영체제
2.39
인천대학교 컴퓨터공학과 성미영
3/28주
Windows XP 클라이언트/서버 구조
Server
(쉬어가기)
1 + 5 + 3 = 148 ?
1+5+3=8?
운영체제
2.40
인천대학교 컴퓨터공학과 성미영
가상 기계 (Virtual Machines)
•
•
가상적(Virtual) : illusion(환상)
가상기계(Virtual machine) (그림 2.15)
» 계층적 접근의 결과
» OS kernel도 bare hardware로 간주
» (예) IBM VM Operating System "VM/CMS"
• Virtual Machine / Conversational Monitoring System
» 각 프로세스에게 실제 컴퓨터의 복사본을 제공하여 각 프로세스들이 자신의
프로세서에서 자신의 메모리를 가지고 수행되는 것 같은(모든 하드웨어를
사용하는 것 같은) 환상(illusion)을 만들어 주는 기계
• CPU 스케줄링
• 가상 기억 장치(virtual memory) 기법 이용
운영체제
•
가상기계의 디스크 시스템
» 3 disk drives  7 VM
• 가상 디스크(virtual disk, (예) minidisks in IBM)로 해결
• 물리적 디스크에서 필요한 만큼의 track할당
•
가상기계의 운영체제
» 각 사용자기 자신의 OS를 수행
» (예) IBM VM OS의 CMS : single user interactive system
2.41
인천대학교 컴퓨터공학과 성미영
시스템 모델
Non-virtual Machine
운영체제
Virtual Machine
2.42
인천대학교 컴퓨터공학과 성미영
가상 기계 (Virtual Machines)
•
•
•
•
•
운영체제
가상 기계 소프트웨어가 하는 일
» 실제 기계상에서 가상기계(multiple virtual machine)를 다중 프로그래밍
(multiprogramming)
기계의 정확한 복제가 쉬운 일이 아님
» 기계 : 2 modes(user mode, monitor mode)
» 가상기계 소프트웨어 : monitor mode에서 동작(진짜 OS)
» 가상기계 자체는 user mode에서만 동작 : virtual user mode에서 system call 
virtual monitor mode
다중 가상 기계의 다중 프로그래밍
» 매우 느림(특권 명령들을 simulate)
가상기계의 장점
» 시스템 자원의 완벽한 보호
• (예) 서로 다른 화일 시스템: cf. UNIX multiuser: 1 화일 시스템
» 시스템 개발 시간의 제거: system programmer의 가상기계에서 시스템 개발
• (Cf.) 보통 시스템에서는 시스템 변경과 검사 동안 시스템 사용 불가
가상기계의 단점
» 자원 공유가 어려움
• 해결
1. minidisk를 공유(물리적 공유 디스크를 소프트웨어적으로 구현)
2. 가상기계 네트워크(물리적 통신망을 소프트웨어적으로 구현)
2.43
인천대학교 컴퓨터공학과 성미영
가상 기계 (Virtual Machines)
운영체제
•
돌아온 VM
» VMs are coming back into fashion
» 시스템 조화성(compatibility) 문제의 해결책
» (예) SunSparc에서 MS-DOS 프로그램 수행
• 본래의 프로세서 위에 가상 인텔 기계(Virtual Intel machine)를
생성(MS-DOS run)
• Intel 명령을 번역  SunSparc 명령어 세트로 변환
• Intel based system에서 수행되는 것 같은 환상 제공
•
(예)
» JVM (Java Virtual Machine)
» Vmware
• http://www.vmware.com
» VPC
• http://www.connectix.com/index_win.html
2.44
인천대학교 컴퓨터공학과 성미영
자바 (Java)
•
•
운영체제
자바 기술: 1995 이후 나타난 Sun Microsystems의 기술
자바 기술의 3 구성요소
» Programming-language specification
• object oriented: class들로 구성
• architecture-neutral: 자바 가상 기계(JVM; Java Virtual
Machine)에서 수행되는 명령어인 바이트코드 출력(bytecode
output, .class) 생성
• distributed: 원래 applets(제한된 자원에 접근하며 웹
브라우저에서 수행되는 프로그램) 지원으로 internet
programming에서 인기, networking 지원, distributed objets(RMI;
Remote Method Invocation) 지원
• multithreaded language: multiple flows of control
• secure: Chapter 19
• memory managing: garbage collection
» API(Application-Programming Interface)
• base API: graphics, I/O, utilities, networking(java.lang, java.awt,
java.io, java.net) 지원
• standard API: enterprise, commerce, security, media 지원
» Virtual machine specification
• JVM: class loader와 Java interpreter로 구성
» class loader: .class files 적재
» Java interpreter: interpreter 또는 JIT(just-in-time) compiler
• Java platform: JVM + Java API
2.45
인천대학교 컴퓨터공학과 성미영
자바 (Java)
•
•
Java platform
» 구현 방법
• on top of a host OS: Unix, Windows
• as part of a web browser: Micosoft Explorer, Netscape
communicator
• in hardware: cellular phones (JavaOS)
» Java application 또는 applet이 실행 (main() method 실행) 될 때마다
JVM의 instance 생성
» 구현방법은 시스템 마다 다르나 표준적인 프로그래밍
인터페이스(architecture-neutral interface) 제공
Java 개발 환경
» compile-time environment: java source(Java program 또는 applet)를
bytecode로 변환
» run-time environment: host computer를 위한 Java platform(JVM)
Java compiler  byte code  JVM  기계어 명령  H/W(그림 3.15)
운영체제
2.46
인천대학교 컴퓨터공학과 성미영
자바 가상 기계 (Java Virtual Machine)
운영체제
2.47
인천대학교 컴퓨터공학과 성미영
자바 플랫폼 (Java Platform)
운영체제
2.48
인천대학교 컴퓨터공학과 성미영
플랫폼에 무관한 Java .class 파일
운영체제
2.49
인천대학교 컴퓨터공학과 성미영
자바 개발 환경 (Java development environment)
운영체제
2.50
인천대학교 컴퓨터공학과 성미영
VMware Architecture
운영체제
2.51
인천대학교 컴퓨터공학과 성미영
 http://www.vmware.com
 컴퓨터 안의 또 하나의 컴퓨터 Virtual Machine을 만들 수 있다
 VM에 다른 OS도 설치가 가능하다
 VMware의 시스템요구사항
 펜티엄 II 266MHz 또는 이상의 호환 프로세서 (펜티엄클래식 최소)
 128MB 이상의 RAM (96MB RAM 최소)
 256 이상의 컬러디스플레이
 랜카드 (가상네트워크를 위한 옵션)
 간편한 설치와 사용이 쉽다.
 설치는 설치프로그램 실행 만으로 끝.
 Configuration Wizard를 이용해서 쉽게 또 다른 OS를 설치할 수 있다
 개별 가상 머신은 호스트 컴퓨터로부터 독립적이므로, 가상 머신에서
실행되는 연산들은 호스트 컴퓨터에 전혀 지장을 주지 않는다
 가상 디스크를 통해 재파티션 할 필요 없이 새로운 운영체제를 추가
시킬 수 있다
운영체제
2.52
인천대학교 컴퓨터공학과 성미영
•
•
운영체제
 VMware의 동작
Host Operating Systems
» For Windows
» For Linux
Guest Operating Systems
» Windows Vista Beta
» Windows Server 2003
» Windows XP
» Windows 2000
» Windows NT 4.0
» Windows Me
» Windows 98
» Windows 95
» MS-DOS 6 and Windows 3.1
» Popular Linux distributions
including Mandrake, Novell,
Red Hat, SuSE, Turbolinux,
Ubuntu
» FreeBSD
» Novell NetWare
» Solaris 10
» Solaris 9
» Sun Java Desktop System 2
2.53
인천대학교 컴퓨터공학과 성미영
(참고) 시스템 설계 및 구현(System Design and Implementation)
•
설계 목적(Design Goals)
»
최상위 결정
•
하드웨어와 시스템 형태(batch, time-shared, single-user, multiuser,
distributed, real-time, general-purpose)
»
Requirements(요구사항)
•
사용자 목적(User goals)
» 배우기 쉽고(easy to learn),
» 사용하기 쉽고(easy to use),
» 신뢰할 수 있고(reliable),
» 안정적이고(safe),
» 빠를 것(fast)
•
시스템 목적(System goals)
» 설계, 구현, 유지가 쉽고(easy to design, implement, maintain),
» 유연하고(flexible),
» 신뢰할 수 있고(reliable),
» 오류 없고(error-free),
» 효율적일 것(efficient)
운영체제
2.54
인천대학교 컴퓨터공학과 성미영
(참고) 시스템 설계 및 구현(System Design and Implementation)
•
기법과 정책(Mechanisms and Policies)
»
기법(Mechanisms) : how to do something
•
»
정책(Policies) : What will be done
•
»
»
•
A general mechanism이면 정책 변경이 몇몇 매개변수 변경만 유도
•
(예) CPU-intensive VS I/O intensive 정책
Microkernel-based OS(Mach)
운영체제
기법과 정책의 확실한 분리
Apple Mac OS
•
»
(예) timer out 시간 결정
정책 결정  기법 결정
•
»
(예) CPU 보호 기법은 Timer로
기법과 정책의 혼합(interface가 Kernel안에  Same look& feel)
정책결정은 자원 할당과 스케줄링에 중요
2.55
인천대학교 컴퓨터공학과 성미영
(참고) 시스템 설계 및 구현(System Design and Implementation)
•
운영체제
구현(Implementation)
» OS를 고급언어로 구현하는 추세
• 최초: Burroughs computer의 Master Control Program(MCP) : ALGOL의 변형
• MULTICS(MIT) : PL/1
• Prime Computer의 Primos OS : FORTRAN의 일종
• UNIX, OS/2, Windows/NT(C++ 약간) : C
• UNIX: CPU Scheduler와 device deriver 부분의 6%인 900여줄만 Assembly어로 쓰임,
94%는 C로
• JVM: Java
» OS를 고급언어로 구현하는 장점
• 1. Faster writting : 코드작성이 빠르고
• 2. Compact codes : 코드가 간결하고
• 3. Easier to understand and debug : 이해와 수정이 쉽고
• 4. Easier to port : 쉽게 이식됨
» MS-DOS : 8088 assembly어로 쓰임  Intel 계열 CPU에만
» Unix : C로 쓰임  Intel 80X86, Motorola 680X0, SPARC, MIPS RX000
» OS를 고급언어로 구현하는 단점
• 1. Reduce speed :속도가 느리고
• 2. Increase storage : 기억장치가 많이 필요
• 그러나 좋은 Compiler로 보완
• 성능의 관건 : 자료구조와 알고리즘 (code가 assembly로 되었거나 고급언어로
되었거나)
• 성능향상
» critical routines(memory manager, CPU scheduler)의 병목(bottlenecks) 
assembly어로 대체
2.56
인천대학교 컴퓨터공학과 성미영
(참고) 시스템 설계 및 구현(System Design and Implementation)
•
운영체제
시스템 생성(System Generation)
» OS는 다양한 기종에 수행되어야 하므로 특정 컴퓨터 site를 위해 시스템을
configure/generate(구성/조립/생성)
» SYSGEN(특별 프로그램) : System generation
» 질문
• What CPU is to be used? 사용 CPU는?
• How much memory is available? 사용가능한 기억장치는?
• What devices are avilable? 사용가능한 주변장치는?
• What operating-system options are desired, or what parameter values are to be
used? 운영체제 안에 선택사항과 매개변수는?
» 보통은 컴파일해서 OS의 새 버전 생성(Tailored)
» 다른 방법
• 1. Precompiled library : 미리 준비된 라이브러리에서 선택
(예) device driver 선택 (재 컴파일 없고 시스템 생성 빠르나 너무 일반적일 수 있음)
• 2. Table driven : 모든 코드는 항상 시스템 안에, 시스템 테이블의 값대로 실행시간에
선택 (시스템 테이블 생성만으로 시스템 생성)
» OS가 생성되면(generation)  hardware가 booting하여 이용
• ROM의 bootstrap loader 또는 bootstrap program  OS load
• MS-DOS : bootstrap loader  bootstrap program(보조기억 장치안에)  OS load
2.57
인천대학교 컴퓨터공학과 성미영
Lab 22. Linux Kernel Compile  5장 후
•
Linux Fedora release 14 Kernel linux-2.6.35.6 커널
컴파일에 대한 물음에 답하세요.
•
•
시스템이 부팅될 때 부트 프로그램에 의해 구동되며
메모리에 상주하면서 시스템의 자원을 관리하며
사용자에게 서비스를 제공하는 운영체제의 핵심
부분을 무엇이라 하나요?
결과 화면을 캡쳐하여 117.16.244.53 숙제방 및
117.16.244.59 숙제방에 복사한다.
•
•
화면 캡쳐하기
•
오늘 현재 시점에서 가장 최신의 안정한 (stable)
커널 버전은 무엇인가요? ( http://www.kernel.org/ )
•
$ dmesg | tail 명령을 입력하여 시스템 메시지 끝부분을
출력한다.
•
리눅스 파일 시스템의 어느 디렉토리 위치에서 커널
소스 코드를 다운로드 해야 하나요?
•
화면에 출력된 내용을 확인하고 키보드의 [Print Screen] 키를
누르면 캡쳐 할 파일명을 입력하는 메시지 창이 출력되게 된다.
•
•
•
•
•
•
•
•
•
•
•
•
파일을 /root에 저장한다.
커널 항목들을 커널에 포함시킬지 모듈로 동작하게
할지 등을 설정 (configuration)을 하기 위해
실행해야 하는 명령은 무엇인가요?
•
•
passwd: *******
•
•
학번으로 디렉토리 생성 : $ mkdir 학번 (앞에 s없이)
•
•
운영체제
새 시스템 호출의 명칭과 번호를 어느 파일에 새로
할당해 주어야 할까요? (두 개 파일의 전체경로로
답하세요)
시스템 호출을 수행하는 system_call() 함수가 실행될
때 참조하는 테이블로서 새 시스템 호출 함수를
등록해 줘야 하는 테이블은 무엇인가요? (전체경로로
답하세요)
•
커널 이미지 생성 (make bzImage)에 걸린 시간은
얼마나 되나요?
•
모듈 컴파일 (make modules)에 걸린 시간은 얼마나
되나요?
•
모듈 설치 (make modules_install)에 걸린 시간은
얼마나 되나요?
2.58
재부팅후 그래픽 모드에서 시스템 호출 프로그램 실행한다:
printk() 는 커널 모드로 출력하는 프로그램이기 때문에 유저
모드의 그래픽 화면에 아무런 내용이 출력되지 않는다
숙제방에 복사하기
$ ftp 117.16.244.53
Name: 아이디
Passwd: *******
ftp> cd /export/home/os2010hw/os2010a (또는 b)
ftp> binary
ftp> put filename.png
숙제방 만들기
$ telnet 117.16.244.53 및 117.16.244.59
login: s학번(2007년 이후 학번들은 200800000 ->
s2800000, 200900000 -> s2900000)
디렉토리 이동 : $ cd /export/home/os2010hw/os2010a
(또는 b)
디렉토리에 퍼미션 설정 : $ chmod 700 학번
인천대학교 컴퓨터공학과 성미영
Related documents