본문 바로가기

전체 글

(4)
Pintos Project 1: THREADS Project 1 demonstration을 위해 플젝 1을 복습해보자. Project 1의 과제는 세 가지: Alarm Clock, Priority Scheduling, Advanced Scheduler이다.플젝1이 나머지랑 비교도 안되게 쉬운거였다니 ㅜㅜ1. Alarm ClockAlarm Clock 과제의 목적은 Busy Waiting 문제를 해결하는 것.timer_sleep은 ticks 동안 해당 스레드를 잠재우는 역할을 한다.가장 이상적인 방법은 잠든 스레드를 블락하고, 잠든 시간 동안 CPU를 주지 않는 것이다.하지만 기존 코드에서는 스레드를 블락하지 않고 계속 CPU가 할당되며,while문으로 시간을 체크하고 다시 yield하는 방식을 사용한다. 해결책: while문 대신 thread_slee..
pintos context switching 이해하기(thread_launch) 교수님 왈 운영체제를 패스하는 사람은 많지만 그중 confident 한 사람은 얼마 없다고.운영체제를 confident 하게 알려면 context switching을 잘 이해해야 하고핀토스 thread_launch의 어셈블리 코드를 이해해야 한다고 한다.휴하나씩 짚어보자. 일단 코드는 다음과 같다. static voidthread_launch (struct thread *th) { uint64_t tf_cur = (uint64_t) &running_thread ()->tf; uint64_t tf = (uint64_t) &th->tf; ASSERT (intr_get_level () == INTR_OFF); /* The main switching logic. * We first restore the who..
Leetcode Daily Challenge #2 [문제] 953. Verifying an Alien Dictionary In an alien language, surprisingly, they also use English lowercase letters, but possibly in a different order. The order of the alphabet is some permutation of lowercase letters. Given a sequence of words written in the alien language, and the order of the alphabet, return true if and only if the given words are sorted lexicographically in this alien lang..
Leetcode Daily Challenge #01 오늘부터 릿코드 데일리 챌린지를 시작한다. 흐흐... ........... 하하...... [문제] #1071. Greatest Common Divisor of Strings For two strings s and t, we say "t divides s" if and only if s = t + ... + t (i.e., t is concatenated with itself one or more times). Given two strings str1 and str2, return the largest string x such that x divides both str1 and str2. [Intuition] 찾으려는 string을 t라고 해보자... 그렇다면 len(t) == gcd(str1, str2..