
Pintos Project 1 final report - Alarm clock, Priority Scheduling, Advanced Scheduling
본 내용은
"
Pintos Project 1 final report - Alarm clock, Priority Scheduling, Advanced Scheduling
"
의 원문 자료에서 일부 인용된 것입니다.
2024.06.10
문서 내 토픽
-
1. Alarm clock기존의 busy-waiting 방식을 sleep/wake-up 방식으로 변경하는 것은 시스템 자원을 효율적으로 사용하는 데 매우 중요하다. busy-waiting 방식은 프로세서가 일정한 시간동안 아무 작업도 하지 않고 반복적으로 상태를 확인하는 방법으로, 타이머나 조건이 충족될 때까지 CPU가 루프를 반복하며 기다린다. 이로 인해 CPU 사이클을 낭비하게 됨으로써 CPU 자원이 불필요하게 낭비되고, 전력 소비를 증가시킬 수 있다. 반면, sleep/wake-up 방식은 프로세서가 작업을 기다리는 동안 유휴 상태로 전환되어 다른 작업을 수행할 수 있게 한다. 따라서 시스템 효율성을 증가시킬 수 있으며, 특히 임베디드 시스템이나 배터리로 구동되는 장치에서 매우 유용하다. 이를 통해 불필요한 자원 낭비를 줄이고, 시스템의 응답성을 높일 수 있다.
-
2. Priority Scheduling기존의 round-robin 방식을 priority scheduling으로 변경할 것이다. pintos가 priority scheduling을 하기 위해서는 ready_list에 push할 때 priority 순서에 따라서 push를 해 줘야 한다. 왜냐하면 다음 thread를 정하는 방식이 schedule()에서 next 변수를 통해서인데, schedule()에서 next_thread_to_run() 함수에 의해서 next 변수가 결정이 되고, next_thread_to_run()에서는 list_pop_front (&ready_list)을 통해서 맨 앞의 항목을 반환하므로 애초에 ready_list에 넣어줄 때 priority를 고려하여 넣어주어야 함을 알 수 있다. 하지만 priority scheduling 과정에서 priority inversion 문제가 발생할 수 있는데, 높은 priority의 thread가 낮은 priority의 thread를 기다리면서 발생한다. priority inversion 문제를 해결하기 위해 priority donation이 도입된다. priority donation은 L이 lock을 보유하는 동안 H가 L에게 priority를 일시적으로 donation(기부)하는 것으로, H의 priority를 얻은 L이 lock을 release하면 H가 lock을 acquire할 수 있다. 이 과정이 끝나면 donation을 취소하고 priority를 원상복귀한다.
-
3. Advanced SchedulingMLFQS 방식으로 구현했다. 2번에서 구현한 priority scheduler는 priority로만 실행순서를 정해서 priority가 낮은 thread는 CPU를 점유하기 힘들다는 단점이 있다. MLFQS는 average response time 등의 priority 외의 다른 요소들을 함께 고려하여 priority를 update해주는 scheduler를 구현하였다. advenced scheduler는 같은 level의 priority마다 ready queue가 각각 지정되어 있어서 해당 priority를 가진 thread를 queue에 넣고 관리한다. pintos의 priority가 0~63의 범위를 가지므로 총 64개의 ready queue를 만들면 된다. priority는 thread 본인이 직접 설정할 수 없고, scheduler가 알아서 priority를 정해준다.
-
1. Alarm clockAlarm clocks are an essential tool for many people to help them wake up on time and start their day. They provide a reliable and consistent way to ensure that we don't oversleep and miss important obligations. However, the use of alarm clocks can also have some downsides. For some people, the sudden and jarring sound of an alarm clock can be disruptive to their sleep cycle and leave them feeling groggy and disoriented in the morning. Additionally, the reliance on alarm clocks can lead to a lack of natural sleep patterns and a decreased ability to wake up naturally. To mitigate these issues, it's important to find an alarm clock that has a gentle, soothing sound and to use it in moderation, allowing for natural waking patterns whenever possible. Overall, alarm clocks are a useful tool, but they should be used thoughtfully and in a way that promotes healthy sleep habits.
-
2. Priority SchedulingPriority scheduling is a crucial aspect of effective time management and task prioritization. By assigning different levels of importance to various tasks and obligations, individuals and organizations can ensure that the most critical and time-sensitive activities are addressed first, while less urgent tasks are completed as time allows. This approach can help to reduce stress, improve productivity, and ensure that important deadlines are met. However, it's important to strike a balance between prioritizing tasks and being overly rigid or inflexible. Unexpected events or emergencies may arise that require a shift in priorities, and it's important to be able to adapt and respond accordingly. Additionally, it's important to consider the long-term impact of prioritization decisions, as some tasks that may seem less urgent in the short-term may have significant consequences if neglected. Overall, effective priority scheduling requires a combination of strategic planning, adaptability, and a nuanced understanding of the relative importance of different tasks and obligations.
-
3. Advanced SchedulingAdvanced scheduling techniques can be a powerful tool for optimizing the use of resources and ensuring the efficient completion of complex tasks and projects. By incorporating factors such as resource availability, task dependencies, and potential bottlenecks, advanced scheduling can help to minimize delays, reduce costs, and improve overall productivity. This can be particularly valuable in industries such as manufacturing, construction, and logistics, where the coordination of multiple moving parts is critical to success. However, the implementation of advanced scheduling systems can also be complex and resource-intensive, requiring significant investment in software, training, and ongoing maintenance. Additionally, the effectiveness of advanced scheduling is heavily dependent on the accuracy and reliability of the data used to inform the scheduling process. Inaccurate or incomplete information can lead to suboptimal scheduling decisions and unexpected delays or complications. As with any complex system, it's important to carefully evaluate the potential benefits and drawbacks of advanced scheduling before implementing it, and to ensure that the system is designed and implemented in a way that aligns with the specific needs and constraints of the organization.