Computer Science/OS 25

Process Synchronization(1)

Background. 공유하는 변수(ex.전역변수)에 동시에 접근할 때, 데이터 일관성(Data Inconsistency)의 문제가 발생할 수 있다! 따라서 공유하는 변수에 접근하는 작업을 순서화,동기화 시켜야 한다. → Process Synchronization Producer(Data를 제공하는 Process)와 Consumer(Data를 받는 Process) 관계에서 Counter라는 전역변수를 사용함으로써 둘 사이 버퍼공간을 모두 사용할 수 있다. Producer는 Counter++; Consumer는 Counter--; Producer와 Consumer는 Counter를 공유하므로 Counter라는 전역변수에 대한 데이터 접근에 순서화, 동기화를 해주어야 한다. → Race Condition이 ..

Computer Science/OS 2023.11.30

5강. 연습문제

5.1 Discuss how the following pairs of scheduling criteria conflict in certain settings. a. CPU Utilization and response time CPU Utilization을 높히기 위해서는 Overhead가 가장 적게 발생하도록 Context Switching이 최소화가 되고, 그렇게 되면 Response time이 최대화가 된다. b. Average turnaround time and maximum waiting time Turnaround time을 최소화 하기 위해서는 SJF 방식을 사용해야 한다. 그렇게 되면 처리기간이 긴 task는 starve하게 되고 이들의 waiting time이 길어진다. c. I/O dev..

Computer Science/OS 2023.11.28

CPU Scheduling (2)

Multilevel Queue ⇒ 여러개의 Ready Queue를 사용하는 방식 Foreground Queue = Interactive한 작업을 하는 Process가 기다리는 Queue Background Queue = Batch한 작업을 하는 Process가 기다리는 Queue 각 Queue마다 적용되는 알고리즘이 다르다! Ex) Interactive한 작업을 하는 Foreground Queue = Round Robin 방식 => 반응시간이 좋아진다. Batch한 작업을 하는 Background Queue = FCFS 방식 Scheduling method between the queues Fixed Priority Scheduling : 무조건 Foreground Queue먼저 처리하고, Backgro..

Computer Science/OS 2023.11.28

CPU Scheduling (1)

CPU Scheduling이란? Memory위에 여러 Process들이 올라가 있는 Multiprogramming 환경에서 CPU Utilization(CPU 이용률)을 최대화 하는 것! CPU-Burst와 I/O-Burst가 순환하는 구조를 가진다. CPU Scheduler : 메모리 위의 여러 ready상태의 프로세스 중 하나를 선택하여 CPU에게 넘겨주는 것. CPU Scheduling을 다음과 같은 상황에서 실행된다. Process가 Running → Waiting 일 때 ( I/O 작업이 시작되었을 때) Process가 Terminated 상태일 때 Process가 Running → Ready 일 때 ( Interrupt가 발생했을 때 → Ready Queue안에 변경사항이 생겼을 때) Proc..

Computer Science/OS 2023.11.27

4강. 연습문제

4강. 연습문제 4.1 Provide two programming examples in which Multithreading does not provide better performance than a single-threaded solution. (1) Sequential Program은 Multithread에 불리하다. 순차 계산 프로그램 . ex. 개인 세금 계산 프로그램. (2) 환경변수, 작업 디렉토리, 파일을 계속 monitor 해야하는 프로그램. ex. C-shell, korn shell 4.3 Which of the following components of program state are shared a cross threads in a multithread process? a. Regi..

Computer Science/OS 2023.11.27

Threads

Threads( Light Weight Process ) ⇒ CPU 이용의 가장 작은 단위. Thread ID Program Counter Register Stack Space 등으로 구성되어있다. Peer Threads 와는 Code Section (명령어) Data Section (명령어 실행에 필요한 정보) OS Resources 등을 공유한다. 🛑 하나의 Process에 하나의 Thread만 존재할 때 Heavy Weight Process라고 한다. Multithread에서는 한 Thread가 Blocked 되어도 다른 Thread가 Run할 수 있다. → 처리량과 성능이 증가한다. ⬆️ ⬆️ ⬆️ ⬆️ ⬆️ ⬆️ ⬆️ ⬆️ Thread의 장점 Responsiveness : 반응시간이 좋아진다. ..

Computer Science/OS 2023.11.25

3강 연습문제

3.1 Describe the differences among short-term, medium-term, and long-term scheduling Short-term Scheduler : Ready Queue에서 Process를 선택하여 CPU에 할당하는 작업을 한다. 아주 빠르고, 자주 일어난다. (frequently, fast) Long-term Scheduler : Job Queue에서 Process를 선택해 Ready Queue로 옮긴다. Degree of Multiprogramming을 Control하는 놈이다. Main Memory에 올라가는 Process의 갯수를 조절하여 degree를 조절한다. Midium-term Scheduler : Swapping을 담당한다. Event를 기다리..

Computer Science/OS 2023.11.25

Processes(2)

Cooperating Process Independent Process : 다른 Process와 독립적으로 동작하는 Process. 다른 Process에 영향을 주지도, 영향을 받지도 않는다. Cooperating Process : 다른 Process들과 영향을 주고받는 Process (ex. Parent-Child Process) 장점 (Advantage of Cooperating Process) 정보 공유 (Information Sharing) 처리속도 향상 (Computation Speed-UP) 모듈화 (Modularity) 편의성 (Convenience) Role Producer : 정보 or 기능을 제공하는 Process (ex. Compiler, Assembler, Webserver) Con..

Computer Science/OS 2023.11.24

Processes(1)

Process a program in execution : 실행중인 프로그램, 다음과 같은 Resource들을 가진다 Program Counter Stack Data Section Process State New : Process가 새로 생겼을 때 Running : Process가 실행중일 때 Waiting : Process가 어떤 Event를 기다리는 상태 (ex. I/O Operations) Ready : Process가 CPU에 할당되기를 기다리는 상태 Terminated : Process의 실행이 완료되고 종료됨. Process Control Block(PCB) 프로세스의 정보를 저장하는 Block. 다음의 정보를 저장한다. Process State Program Counter ( 다음 Instr..

Computer Science/OS 2023.11.24

운영체제 2강 연습문제

2.5 What is the purpose of the Command interpreter? Why is it usually seperate from the kernel? Would it be possible for the user to develope a new Command interpreter using the System Call interface provided by the Operating System? Purpose : User나 File로부터 Command를 받아 실행할 때, 한개 이상의 System Call을 호출한다. Kernel이 아닌 Command Interpreter가 command를 받아 처리한다. Command Interpreter가 변결될 수 있어 Kernel과 Command..

Computer Science/OS 2023.11.21