일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
1 | 2 | 3 | 4 | 5 | ||
6 | 7 | 8 | 9 | 10 | 11 | 12 |
13 | 14 | 15 | 16 | 17 | 18 | 19 |
20 | 21 | 22 | 23 | 24 | 25 | 26 |
27 | 28 | 29 | 30 | 31 |
Tags
- 깃컨벤션
- 말하기시험
- MIPS
- 컴퓨터공학과
- 코멘토5주인턴
- 파이썬
- 깃충돌
- 백엔드
- 스프링장점
- 코드잇
- 코멘토취업
- JS
- .env파일
- 제품증정 #에스트라 #에스트라퓨처랩서포터즈 #리제덤아이세럼 #더마아이세럼 #레티노이드아이세럼
- gitconvetion
- 코드잇파이썬
- 컴공
- Python
- 졸업영어
- CA
- 스프링부트개발
- 컴퓨터구조
- 방학
- 컴퓨터공학
- 소프트웨어
- 개발자
- 개발
- Git
- codeit
- computerarchitecture
Archives
- Today
- Total
sollog
Chapter 2 Operating-System Structures 본문
728x90
반응형
1 Operating System Service
#Operating System Service 운영체제 시스템 서비스
- Operating systems provide an environment for execution of programs and service to programs and users (운영체제는 프로그램과 유저들에게 시스템 실행을 위한 환경을 제공한다.
- Service for user (유저들을 위한 서비스)
- User interface (유저 인터페이스 유저 화면)
- I/O operations (입출력 연산자)
- File-system manipulation (파일 시스템 조작)
- Communications (의사소통)
- Error detection (에러 감지)
- Functions for efficient operation of system itself 시스템의 효율적인 작동을 위한 함수
- Resource allocation 자원 할당
- Logging 로깅
- Protection and security 정보 보안
#User Interfaces: CLI
- Command line interface or command interpreter allows direct command entry (명령줄 인터페이스 또는 명령 해석기를 통해 직접 명령 입력)
- Sometimes implemented in kernel, sometimes by systems program (때로는 커널에서 구현되기도하고, 때로는 시스템 프로그램에 의해 구현되기도 합니다.)
- Sometimes multiple flavors implemented (때때로 여러가지 버전이 구현됨.)
- shells
- Primarily fetches a command from user and exercise it (주로 사용자로부터 명령을 가져와 실행합니다.)
- Sometime command built-in, sometimes just names of program (때로는 명령이 내장되어 있거나, 프로그램이름만 있기도 하다)
#User Interfaces: GUI
- User-friendly desktop metaphor interface
- Usually mouse, keyboard, and monitor
- Icons represent files, programs, actions, etc
- Various mouse buttons over objects n the interface cause various actions (provide information, options, execute function, open directory (known as a folder)
- Invented at Xerox PARC
#User Interfaces : Touchscreen Interface
- Touchscreen devices require new interfaces
- Mouse —-등등
2 System Calls
#System Calls (시스템 호출)
- System calls provide an interface to the services made available by an operating system
- Function calls to OS kernel available through interrupt
- Generally, provide as interrupt handlers written in C/C++ or assembly
- A mechanism to transfer control safely from lesser privileged modes to higher privileged modes (낮은 권한 모드에서 높은 권한 모드로 제어권을 안전하게 전송하는 메커니즘, 여기서 higher은 kernel mode를 의미함)
- POSIX system calls : open, close, read, write, fork, kill, wait..
- Mostly accessed by programs via a high-level Application Programming Interface (API) rather than direct system call use ( API는 high-level 이다)
- Dual-mode operation (듀얼모드 작동)
- User mode (사용자 모드)
- User defined code(application) (사용자 정의 코드 (응용프로그램)
- Privileged instructions, which can cause harm to other system, are prohibited (다른 시스템에 해를 끼칠 수 있는 특권 명령어 금지)
- Kernel mode (커널모드)
- Os code, System call → Privileged instruction are permitted (OS코드, 시스템 호출 → 특권 명령어 허용)
- User mode (사용자 모드)
#Example of System Calls (시스템 호출 예시)
open ()
Open and possibly create a file (파일 열기 및 생성 가능)
- Open the file specified by pathname (경로명으로 지정된 파일 열기 )
- if the specified file does not exist it may optionally be created (지정된 파일이 존재하지 않는 경우 선택적으로 생성될 수 있습니다.
- int open(const char *pathname, int flags); // 파라미터가 3개
- int open(const char *pathname, int flags, mode_t_mode); //파라미터가 3개
read() 읽기
Read from a file descriptor 파일 설명자에서 읽기
- Read up to count by bytes from file descriptor fd into buffer starting at buf
(파일에서 최대 개수의 바이트를 읽음)
- Return value (반환 값)
- Success : the number of bytes read (성공 : 읽은 바이트 수 )
- the position is advanced by this parameter ㅇ파일 위치가 이 숫자 만큼 앞
- Fail : -1 (실패)
- errono is set to indicate error (errono는 오류를 나타내도록 설정됨)
- Success : the number of bytes read (성공 : 읽은 바이트 수 )
write()쓰기
Write to a file descriptor 파일 설명자에 쓰기
- Writes up to count bytes from the buffer starting at buf to the file reffered to by the file descriptor ( buf 에서 시작하는 버퍼의 최대 count 바이트를 파일 설명자 fd가 참조하는 파일에 씀)
Return Value (반환값)
- Success : the number of bytes read (성공 : 읽은 바이트 수 )
- the position is advanced by this parameter ㅇ파일 위치가 이 숫자 만큼 앞
- Fail : -1 (실패)
- errono is set to indicate error (errono는 오류를 나타내도록 설정됨)
#Example of System Calls
- System call sequence to print the contents of file
실행결과 그 연 파일의 내용이 코드 내에 찍히게 됨
printfile
#System Calll - OS Relationship
#System Call Implementation / 시스템 호출 구현
- Typically, a number associated with each system call
- Sytem-call interface maintains a table indexed according to these numbers
- The system call interface invokes the intended system call in OS kernel and returns status of the system call and any return values
- Passing to kernel mode
- Switch to kernel mode
- Any data proceesing and perparation for execution in kernel mode
- The caller need know nothing about how the system call is implemented
- Just needs to obey API and understand what OS will do as a result call
- Most details of OS interface hidden from programmer by API
- System call vs I/O functions in programming languages
- write() vs printf()
- printf() is implemented using write / printf()의 경우 write()을 통해서 구현 되어짐
- write() : provided by OS / write()함수는 운영체제에서 제공함
- printf() : standard function defined in C language / 기본 C 언어에 의해 기본 함수로 정의됨
- read () vs fread ()
- fread() is implemented using read() / fread() 파일읽는 함수는 read()함수에 의해 정의됨
- printf() is implemented using write / printf()의 경우 write()을 통해서 구현 되어짐
- write() vs printf()
728x90
반응형
'자기계발 > Study' 카테고리의 다른 글
sort의 종류 (0) | 2024.06.20 |
---|---|
quiz 6 (0) | 2024.06.06 |
heap sort (1) | 2024.02.14 |
[Node.js] 자바스크립트 기초 문법과 모듈 (0) | 2024.01.22 |
[codeit] Node.js (1) | 2024.01.16 |