전체 글 99

7-3. Task Scheduling in Linux (3)

중앙대학교 3-2 리눅스 응용 설계 (손용석 교수님) 과목 정리입니다. Task Group and Task Scheduling Entity Only Considering Fairness of Tasks task의 관점에서 CPU allocation은 공정하다. user의 입장에서는 CPU allocation이 공정하지 않다. CFS는 task group이 user 사이의 fairness를 보장하도록 지원해야 한다. task group은 task 뿐만 아니라 다른 task group도 포함할 수 있다. Task scheduling entity scheduling의 단위로서 task와 task group을 모두 지원하기 위해 scheduling entity의 개념이 도입되었다. task 나 task grou..

7-2. Task Scheduling in Linux (2)

중앙대학교 3-2 리눅스 응용 설계 (손용석 교수님) 과목 정리입니다. Importance of Fair-Share Scheduling fairness 보장이 제대로 이루어지지 않으면 server / cloud computing에서 문제가 발생할 수 있다. (다른 user or group에서 starvation이 일어날 수도 있음) Fair-share scheduling process 사이에서 자원을 균등하게 분배하는 것이 아닌 user 또는 group 사이에서 자원을 균등하게 분배한다. Completely Fair Scheduler (CFS) Linux kernel의 primary task scheduler process를 실행하기 위한 CPU resource 할당을 처리하고, 전체 CPU 활용률을 극..

7-1. Task Scheduling in Linux (1)

중앙대학교 3-2 리눅스 응용 설계 (손용석 교수님) 과목 정리입니다. Scheduling? OS는 한 번에 2개 이상의 task를 실행 가능한 메모리에 load할 수 있다. load된 task들은 time multiplexing을 사용하여 CPU 자원을 공유한다. Goals of Scheduling 모든 scheduler는 다음의 규칙을 따르기 위한 strategy를 선택한다. Utilization (효율) CPU가 유용한 work로 최대한 바쁜 상태로 유지한다. Throughput 시간당 처리되는 task의 개수를 최대화한다. Turnaround time task가 시작되는 시간과 끝나는 시간 사이의 시간을 최소화한다. Fairness 각각의 task가 CPU를 공평하게 공유하도록 한다. Linux ..

6-4. Synchronization (4)

중앙대학교 3-2 리눅스 응용 설계 (손용석 교수님) 과목 정리입니다. Implementation of Spinlock in Linux Kernel Big-endian next가 low addr owner가 high addr Little-endian owner가 low addr next가 high addr Little Endian and Big Endian Little Endian : LSB가 low address에 저장 Big Endian : MSB가 low address에 저장 ldrex : global variable (&lock→slock)을 lockval에 대입 add : lockval에 TICKET_SHIFT 추가한 값을 newval에 대입 strex : global variable 업데이트 ..

6-3. Synchronization (3)

중앙대학교 3-2 리눅스 응용 설계 (손용석 교수님) 과목 정리입니다. Spinlock in Linux Kernel spinlock 은 lock을 사용할 수 있는지 반복적으로 확인하는 동안 lock을 획득하려는 thread가 loop에서 대기하도록 하는 lock thread가 active한채로 남아있는데 useful task를 수행하지 않기 때문에 spinlock의 사용은 busy waiting의 일종이다. thread는 lock을 사용할 수 있게 될 때까지 계속 spinning 계속되는 반복은 multiprogramming environment 에서 문제가 생길 수 있다. Spinlock의 busy waiting은 CPU cycle을 낭비한다. Spinlock은 context switching이 필요 ..

6-2. Synchronization (2)

중앙대학교 3-2 리눅스 응용 설계 (손용석 교수님) 과목 정리입니다. Disabling Preemption task들 사이의 race condition을 막는다. (single core) task1이 critical section을 실행하는 동안 task2에게 preempt 당함 다른 Task가 critical section을 실행하는 동안에는 preemption disable 하고, ciritical section을 종료하면 preemption enable multi-core의 race condition은 막지 못한다. task 1에서 preemption을 막아도 다른 core에서 critical section에 접근하는 것을 막을 수 없다. task와 ISR 사이의 race condition을 막을..

6-1. Synchronization (1)

중앙대학교 3-2 리눅스 응용 설계 (손용석 교수님) 과목 정리입니다. Synchronization The need for synchronization Shared resources (data structures, variables) When multiple threads are dependent on a shared resource and they need to access it at the same time, it needs to ensure that only one thread accesses it at a given point in time. ** child thread는 parent thread의 global variable에 접근 가능 ** child process는 parent process..

5. Process and Thread

중앙대학교 3-2 리눅스 응용 설계 (손용석 교수님) 과목 정리입니다. From a Program to a Process Program sequence of instructions + data + metadata for program loading and execution Process in Linux Process means “running program” system에서 현재 실행되고 있는 program whenever program / command is executed / issued in linux, it creates / starts a new process pwd 가 실행되면 process가 시작된다. Linux는 5자리 ID 번호로 process를 기록 → PID (process ID) s..

4-2. Kernel module

중앙대학교 3-2 리눅스 응용 설계 (손용석 교수님) 과목 정리입니다. What is Kernel modules in Linux module은 필요에 따라 kernel에 load되거나 unload 될 수 있는 code 조각 system을 reboot할 필요 없이 kernel의 functionality를 확장시킬 수 있다. module의 하나인 device driver는 kernel이 system에 연결되어 있는 hardware에 접근할 수 있도록 한다. module 없으면, monolithic kernel을 구축하고 새로운 기능을 kernel image에 직접 추가해야 한다. 게다가 larger kernel을 갖고 있다면, 새로운 기능이 추가될 때마다 매번 kernel을 rebuild, reboot하는 ..

4-1. Design Principle of Linux Kernel

중앙대학교 3-2 리눅스 응용 설계 (손용석 교수님) 과목 정리입니다. Monolithic Kernel vs . Microkernel kernel이 OS의 가장 중요한 부분 Monolithic kernel OS architecture device drivers, file system, IPC 같은 대부분의 component가 kernel space에 포함 실행 가능한 module을 runtime에 dynamically load & unload 가능 Microkernel software의 near-minimum amount OS를 구현하기 위한 mechanism을 제공 mechanism은 address space management, thread management, inter-process communi..