๋ณธ๋ฌธ ๋ฐ”๋กœ๊ฐ€๊ธฐ

๐Ÿš— Major Study (Bachelor)164

์•Œ๊ณ ๋ฆฌ์ฆ˜ 9์ฃผ์ฐจ ๋ชฉ์š”์ผ 2022. 4. 28.
[OS /์šด์˜ ์ฒด์ œ] Thread Scheduling, Contention Scope, Pthread Scheduling, Linux Scheduler, Linux CFS Scheduler, Windows Scheduling, Process Synchronization, Critical Section, Progress Thread Scheduling Kernel Thread๊ฐ€ Scheduling์˜ ๋‹จ์œ„๊ฐ€ ๋œ๋‹ค. PCB์— ๋ฉ”๋‹ฌ๋ ค ์žˆ๋Š” LWP๊ฐ€ ์žˆ๋‹ค. LWP์™€ Thread๋Š” One to one correspondence๊ฐ€ ์žˆ๋‹ค. ํ•˜๋‚˜์˜ ํ”„๋กœ์„ธ์Šค๊ฐ€ ์žˆ๊ณ  ์—ฌ๋Ÿฌ ๊ฐœ์˜ Kernel์— ํ•ด๋‹นํ•˜๋Š” LWP๊ฐ€ ์กด์žฌํ•œ๋‹ค. ์‹ค์ œ ์Šค์ผ€์ค„๋ง์€ LWP ๋‹จ์œ„๋กœ ์ด๋ฃจ์–ด์ง€๋Š” ๊ฒฝ์šฐ๊ฐ€ ๋งŽ๋‹ค. Contention Scope PCS์™€ SCS๊ฐ€ ์žˆ๋‹ค. Scheduling์€ kernel์—์„œ ์ด๋ฃจ์–ด์ง€๊ณ  (CPU๋ฅผ Kernel Thread๋กœ ๋‚˜๋ˆ ์ฃผ๋Š” ๊ฒƒ) ์ด๋•Œ ๊ฒฝ์Ÿ์ด ๋ฐœ์ƒํ•˜๋Š”๋ฐ ์ด๋•Œ๋ฅผ SCS๋ผ๊ณ  ํ•œ๋‹ค. ๋‘ ๋ฒˆ์งธ๋กœ Process ์•ˆ์—์„œ์˜ ๊ฒฝ์Ÿ์ด๋‹ค. User Process ์•ˆ์—์„œ์˜ ๊ฒฝ์Ÿ์ด PCS๋ผ๊ณ  ํ•œ๋‹ค. Pthread Scheduling pthread_attr_ini.. 2022. 4. 28.
9์ฃผ์ฐจ ํ™”์š”์ผ ์•Œ๊ณ ๋ฆฌ์ฆ˜ Graph Exploration Vertex์— ๊ฐ€์„œ ๋ฌด์—‡์ธ๊ฐ€ ์ผ์„ ํ•˜๋Š” Count, number ํ•˜๋Š” ๊ฒƒ์„ Visit์ด๋ผ๊ณ  ํ•œ๋‹ค. BFS์™€ DFS ๋‘ ๊ฐ€์ง€ ๋ฐฉ๋ฒ•์ด ์žˆ๋‹ค. Connected Component๊ฐ€ ๋ฌด์—‡์ธ์ง€๋ฅผ ์ฐพ์•„๋‚ด์•ผ ํ•œ๋‹ค. Vertex์™€ node ๋“ค์ด ๋‹ค ์—ฐ๊ฒฐ ์•ˆ๋  ์ˆ˜ ๋„ ์žˆ๋‹ค. ๋…๋ฆฝ๋œ Component๋ฅผ ํŒ๋‹จํ•  ์ˆ˜ ์žˆ์–ด์•ผ ํ•œ๋‹ค. Spanning tree๋ฅผ ๊ณ„์‚ฐํ•˜๋Š” ๊ฒƒ๋„ ๋‹ค์‹œ ๊ณต๋ถ€ํ•ด๋ณผ ๊ฒƒ์ด๋‹ค. BFS Tree ์•ˆ์—๋Š” ๊ธฐ๋ณธ์ ์œผ๋กœ ๋ชจ๋“  Vertex๊ฐ€ ํฌํ•จ๋˜์–ด์•ผ ํ•œ๋‹ค. ๋ชจ๋“  Edge๋Š” ํฌํ•จ๋˜์ง€ ์•Š์„ ์ˆ˜๋„ ์žˆ๋‹ค. Explored edge๋Š” ์ถ”ํ›„์— ๋” ์•Œ์•„๋ณด๊ธฐ๋กœ ํ•จ. One vertex at a time, Serial ๋ชจ๋“œ์—์„œ ๋‹ค๋ฃจ๊ธฐ ๋•Œ๋ฌธ์— ํ•œ ๋ฒˆ์˜ Vertex๋ฅผ ๋‹ค๋ฃฌ๋‹ค. ์ž„์˜์˜ vertex๋ฅผ ์‚ฌ์šฉํ•˜๋Š”.. 2022. 4. 27.
[OS / ์šด์˜ ์ฒด์ œ] Priority Scheduling, Round Robin Scheduling, Multilevel Queue Scheduling, Multilevel FeedBack-Queue Scheduling, Multi Processor Scheduling, Processor Affinity Priority Scheduling ํ”„๋กœ์„ธ์Šค ๋ณ„ ์šฐ์„ ์ˆœ์œ„๊ฐ€ ๋‹ค ๋‹ค๋ฅด๋‹ค. System call์˜ ์šฐ์„ ์ˆœ์œ„๋ฅผ ๋†’๊ฒŒ ์ค˜์•ผ ํ•œ๋‹ค. ์šฐ์„ ์ˆœ์œ„ ๋†’์€ ๊ฒƒ ๋จผ์ € ์‹คํ–‰ํ•˜์ž๋Š” ์•Œ๊ณ ๋ฆฌ์ฆ˜์ด๋‹ค. P1 - P5๊นŒ์ง€ ์žˆ๊ณ  Burst Time์ด ์žˆ๋‹ค. Burst Time์€ CPU ์˜ ํ•˜๋‚˜์˜ ๊ธธ์ด๋ฅผ ์˜๋ฏธํ•œ๋‹ค. ๊ทธ๋ฆฌ๊ณ  ๊ฐ ํ”„๋กœ์„ธ์Šค ๋ณ„ ์šฐ์„ ์ˆœ์œ„๊ฐ€ ์ฃผ์–ด์ ธ ์žˆ๋‹ค. Priority ๋ฒˆํ˜ธ๊ฐ€ ๋‚ฎ์„ ์ˆ˜๋ก ์šฐ์„ ์ˆœ์œ„๊ฐ€ ๋†’์€ ๊ฒƒ์ด๋‹ค. 1๋ฒˆ์ด ๊ฐ€์žฅ ๋†’์€ ๊ฒƒ์ด๊ณ  5๋ฒˆ์ด ๊ฐ€์žฅ ์šฐ์„ ์ˆœ์œ„๊ฐ€ ๋‚ฎ์€ ๊ฒƒ์ด๋‹ค. ๋™์‹œ์— ํ”„๋กœ์„ธ์Šค๊ฐ€ ๋“ค์–ด์˜ค๋ฉด P2๊ฐ€ ์ œ์ผ ๋จผ์ € ์‹คํ–‰๋œ๋‹ค. (๋ฒˆํ˜ธ๊ฐ€ ๋‚ฎ์€ ์šฐ์„ ์ˆœ์œ„๊ฐ€ ๋†’์€ ๊ฒƒ์ด ๋จผ์ € ์‹คํ–‰๋จ). 1ms ๋งŒํผ ๋Œ๊ฒŒ ๋˜๊ณ  ๊ทธ ๋‹ค์Œ์œผ๋กœ P5๊ฐ€ 5ms ๋งŒํผ ๋Œ๊ฒŒ ๋œ๋‹ค. ์ด๋ ‡๊ฒŒ ๋Œ์•„๊ฐ€๊ฒŒ ๋œ๋‹ค. Prority Scheduling External ์™ธ๋ถ€์—์„œ ์ฃผ๋Š”.. 2022. 4. 25.
์•Œ๊ณ ๋ฆฌ์ฆ˜ 7์ฃผ์ฐจ ๋ชฉ์š”์ผ 105๋‹ฌ๋Ÿฌ๋กœ ๊ณ„์‚ฐ๋˜๋Š” ์ด์œ  ์ƒ๊ฐํ•ด๋ณด๊ธฐ. 2022. 4. 14.
[OS / ์šด์˜์ฒด์ œ] CPU-I/O Burst Cycle, CPU Scheduler, Preemptive Scheduling, Scheduling Criteria, Shortest Job First Scheduling CPU-I/O Burst Cycle read from file์„ ํ•˜๋ฉด IO๋ฅผ ์‚ฌ์šฉํ•œ๋‹ค. ํ”„๋กœ์„ธ์Šค๊ฐ€ ์‹คํ–‰์„ ํ•˜๋‹ค๋ณด๋ฉด ์–ด๋–จ ๋•Œ๋Š” IO๋ฅผ ์“ฐ๊ณ  ์–ด๋–จ ๋•Œ๋Š” CPU๋ฅผ ์“ด๋‹ค. IO๋ฅผ ์‚ฌ์šฉํ•˜๋Š” ๊ตฌ๊ฐ„์„ IO Burst๋ผ๊ณ  ๋ถ€๋ฅธ๋‹ค. ๊ต๋Œ€๋กœ ๋ฐฐ์น˜๊ฐ€ ๋˜๊ฒŒ ๋œ๋‹ค. Process๊ฐ€ ๋งŒ๋“ค์–ด์ง€๋ฉด Ready Queue๋กœ ๋“ค์–ด๊ฐ„๋‹ค. ๊ฐ•์ œ ์ข…๋ฃŒ๋ฅผ ์‹œํ‚ค๋ฉด ๋งˆ์ง€๋ง‰์ด IO์ผ์ˆ˜๋„ ์žˆ์ง€๋งŒ ์ •์ƒ์ ์ธ ๊ฒฝ์šฐ ์ฒ˜์Œ๊ณผ ๋งˆ์ง€๋ง‰์€ CPU์ด๋‹ค. Historgram of CPU burst Duration CPU burst์˜ ๋Œ€๋ถ€๋ถ„์€ ์งง๋‹ค. ์ „์ฒด์ ์œผ๋กœ ๋ณด๋ฉด ์งง์€ ๊ฒƒ์ด ๋งŽ์ง€๋งŒ ๊ฐ€๋”์‹ ๊ธด burst๊ฐ€ ๋‚˜์˜จ๋‹ค. ์งง์€ ๊ฒฝ์šฐ๋Š” IO Bound์—์„œ ์˜จ ๊ฑฐ๊ณ  ๊ธด ๋ถ€๋ถ„์€ CPU Bound์—์„œ ์˜จ ๊ฒฝ์šฐ๊ฐ€ ๋งŽ๋‹ค. CPU Scheduler short term scheduler๋กœ ๋ถˆ.. 2022. 4. 14.
[ OS / ์šด์˜์ฒด์ œ] Thread Pools, fork() and exec(), Thread Local Storage in pthread, Signal Handling Windows์—์„œ ์–ด๋–ป๊ฒŒ ์“ฐ์ด๋Š” ์ง€๋„ ์ž˜ ์ตํ˜€ ๋†“์„ ๊ฒƒ Implicit Thread ๋ช…์‹œ์ ์œผ๋กœ ๋งŒ๋“ค์ง€ ์•Š์•„๋„ MultiThread๋ฅผ ์‚ฌ์šฉํ•  ์ˆ˜ ์žˆ๋Š” ๋ฐฉ๋ฒ•์ด ์กด์žฌํ•œ๋‹ค. THread Pools, OpenMP, Grand Central Dispatch์˜ ๋ฐฉ๋ฒ• 3๊ฐ€์ง€ ์กด์žฌํ•œ๋‹ค. ์•ž์˜ ๋‘ ๊ฐ€์ง€๋งŒ ์„ค๋ช…ํ•  ์˜ˆ์ • Thread Pools ์š”์ฒญ์„ ํ•  ๋•Œ๋งˆ๋‹ค Thread๋ฅผ ์ฒ˜๋ฆฌํ•˜๊ณ  ์—†์• ๊ณ  ์ฒ˜๋ฆฌํ•˜๊ณ  ์—†์• ๊ณ ์˜ ๊ณผ์ •์„ ๋ฐ˜๋ณตํ•œ๋‹ค. ์‹œ๊ฐ„์€ ์งง์ง€๋งŒ ๊ณ„์† ๋ฐ˜๋ณต์ ์ธ ์ž‘์—…์„ ํ•ด์•ผํ•˜๋Š” ๊ฒฝ์šฐ๊ฐ€ ์ƒ๊ธด๋‹ค. ์ด๋Ÿฐ ๊ฒฝ์šฐ ์ž‘์—… ํ•˜๋Š” ๊ฒƒ๋ณด๋‹ค ๋งŒ๋“ค๊ณ  ์—†์• ๋Š” ๊ฒƒ์˜ Overhead๊ฐ€ ๋” ์ปค์ ธ๋ฒ„๋ฆฐ๋‹ค. ์ด๋ฅผ ํ•ด๊ฒฐํ•˜๊ธฐ ์œ„ํ•œ ๊ฒƒ์ด Thread Pool์ด๋ผ๊ณ  ํ•œ๋‹ค. ์‚ด์•„์žˆ๋Š” Thread๋ฅผ ๋ช‡ ๊ฐœ ๋งŒ๋“ค๊ณ  ์‚ด๋ ค์„œ ์ด๋ฅผ ๊ณ„์† ์‚ฌ์šฉํ•˜๋Š” ๊ฒƒ์„ ์˜๋ฏธํ•œ๋‹ค. ์ œ์ผ ์ค‘์š”ํ•œ ์ ์€ Th.. 2022. 4. 11.
์•Œ๊ณ ๋ฆฌ์ฆ˜ 7์ฃผ์ฐจ ์›”์š”์ผ Branch and Bound - Best First Search ๋ชจ๋“  Node๋ฅผ ๋ฐฉ๋ฌธํ•˜์ง€ ์•Š๋Š”๋‹ค. ๋งŒ๋“ค์ง€๋„ ์•Š๋Š”๋‹ค. Start์—์„œ๋Š” ๋‘ ๊ฐœ์˜ Node๋ฅผ ๋งŒ๋“ค์ง€๋งŒ Expand๋ฅผ ํ•  ๊ฒƒ์ธ๊ฐ€ ์•„๋‹ˆ๋ฉด ๊ทธ๋งŒ ๋‘˜ ๊ฒƒ์ธ๊ฐ€๋ฅผ ๊ฒฐ์ •ํ•ด์•ผ ๋œ๋‹ค. ๋ฐฉ๋ฌธํ•˜์ง€ ์•Š๋Š”๋‹ค๋ฉด ๊ฒฝ์šฐ์˜ ์ˆ˜๊ฐ€ ์ค„์–ด๋“ค๊ฒŒ ๋œ๋‹ค. ๊ทธ๋Ÿด๋งŒํ•œ ๊ฐ€์น˜๊ฐ€ ์žˆ๋Š” ์ง€๋ฅผ ํŒ๋‹จํ•˜๋Š” ์ž‘์—…์„ ํ•ด์•ผ ํ•œ๋‹ค. Item should be sorted in descending order according to bi/wi ์ฒซ ๋ฒˆ์งธ O1์ด ๋‹จ์œ„ ๋ฌด๊ฒŒ๋‹น ๊ฐ€์น˜๊ฐ€ ํฐ ๊ฒƒ์ด ์˜ค๊ฒŒ ๋˜๋Š” sorting์„ ๊ฑฐ์ณ์•ผ ํ•œ๋‹ค. Branch and Bound ๊ฐ๊ฐ์˜ Node๋งˆ๋‹ค Benefit weight bound๋ฅผ ๊ณ„์‚ฐํ•œ๋‹ค. ์ฒซ ๋ฒˆ์งธ ์•„์ดํ…œ์„ Knapsack ์ง‘์–ด๋„ฃ์—ˆ์„ ๋•Œ ์ด์ต์„ ๊ณ„์‚ฐํ•ด์•ผ ํ•œ๋‹ค. Don't ch.. 2022. 4. 8.
์•Œ๊ณ ๋ฆฌ์ฆ˜ 6์ฃผ์ฐจ ๋ชฉ์š”์ผ 2022. 4. 7.
[OS / ์šด์˜์ฒด์ œ] POSIX PThreads, Windows Threads, Thread Libraries ํ•˜๋‚˜๋Š” Kernel Scheduler ๋‹ค๋ฅธ ํ•˜๋‚˜๋Š” Kernel์ด ์“ฐ๋ ˆ๋“œ๋ฅผ ์ œ๊ณต์•ˆํ•ด๋„ User Level์—์„œ ์ œ๊ณตํ•˜๋Š” User level library๊ฐ€ ์กด์žฌํ•œ๋‹ค. POSIX Pthreads๋Š” ๊ตฌ์ฒด์ ์ธ ๊ตฌํ˜„์ฒด๊ฐ€ ์•„๋‹ˆ๋ผ ์–ด๋– ํ•œ ํ•จ์ˆ˜๊ฐ€ ์–ด๋–ค ๊ธฐ๋Šฅ์„ ๊ฐ€์ง€๊ณ  ์žˆ์–ด์•ผ ํ•œ๋‹ค๊ณ  ๊ธฐ๋กํ•œ ๋ช…์„ธ์„œ ๋Š๋‚Œ์ด๋‹ค. LinuxThreads, NPTL ์“ฐ๋ ˆ๋“œ ๋“ฑ์„ ์‚ฌ์šฉํ•˜๊ธฐ๋„ ํ•œ๋‹ค. POSIX PThreads ์–ด๋–ค ํ•จ์ˆ˜๋ฅผ ์จ์•ผ ํ•˜๋Š”๊ฐ€? ์ œ์ผ ์ค‘์š”ํ•œ ํ•จ์ˆ˜๋Š” pthread_create ์ด๋‹ค. ์“ฐ๋ ˆ๋“œ๋ฅผ ๋งŒ๋“ค์–ด๋‚ธ๋‹ค. ์„ธ ๋ฒˆ์งธ ํŒŒ๋ผ๋ฏธํ„ฐ๊ฐ€ ์ œ์ผ ์ค‘์š”ํ•˜๋‹ค. function pointer์ด๋‹ค. C์–ธ์–ด์—์„œ ์ž˜ ๋ณด์ง€ ๋ชปํ–ˆ๋˜ ๋ฌธ๋ฒ•์ฒ˜๋Ÿผ ๋Š๊ปด์งˆ ๊ฒƒ์ด๋‹ค. ํ•จ์ˆ˜๋Š” ํŠน์ •ํ•œ ์œ„์น˜๋กœ ๋›ฐ์–ด๋“œ๋Š” ๊ฒƒ์„ ์˜๋ฏธํ•œ๋‹ค. ํ•จ์ˆ˜์˜ ์ด๋ฆ„์€ ์ฃผ์†Œ๋ผ๋Š” ๊ฒƒ์„ .. 2022. 4. 7.