os 기출문제
본 내용은
"
os 기출문제
"
의 원문 자료에서 일부 인용된 것입니다.
2024.08.15
문서 내 토픽
  • 1. Process Synchronization
    1. 현재 count 변수의 값이 5이고, 두 프로세스 producer와 consumer가 각각 다음과 같이 (interleaved) 실행된다고 할 때, 마지막으로 저장되는 counter 변수의 값은 6입니다. 2. 다른 프로세스(또는 스레드)들과 공유하는 자원(변수, 파일 등)을 다루는 코드 영역을 일컫는 용어는 critical section입니다. 3. non-preemptive scheduling을 설명하는 말이 아닌 것은 2) The scheduler can interrupt a job and force a context switch입니다. 4. EDF(early deadline first), RMS(rate monotonic scheduling)과 같이 시간 제약이 엄격한 실시간 스케줄링 기법은 hard realtime 시스템을 위해 고안된 것들입니다. 5. MLFQ 스케줄링에서 상위 priory queue에는 I/O bound 프로세스들이 주로 존재합니다. 6. MLFQ에서 각 queue별 스케줄링 기법은 1) 최상위 queue: round-robin, 2) 중간 queue: round-robin, 3) 최하위 queue: FCFS입니다. 7. xv6 시스템 소스 코드 중에서 process 관련 system call 핸들러들이 들어있는 파일 명은 proc.c입니다. 8. critical section 해법이 갖춰야 할 요건이 아닌 것은 4) Inheritance입니다. 9. 여러 프로세스들이 공유 데이터를 다루는 협업 프로그램에서, 그 결과를 예측할 수 없는 상황을 race condition이라고 부릅니다.
  • 2. Thread
    1. POSIX pthread에서 fork()는 이 시스템콜을 호출하는 thread만 복제합니다. 2. thread cancellation 방법 중 thread 연산 과정이 안전한 상태에 이를 때까지 thread 종료 시점을 지연하는 방법을 deferred cancellation이라고 합니다. 3. 지역변수만을 사용하는 라이브러리 함수는 multithread-safe하지 않습니다. 4. 쓰레드 간에 공유되지 않는 데이터는 지역 변수입니다. 5. 특정 쓰레드가 합류하기를 기다리는 pthread 함수는 pthread_join입니다. 6. pthread 함수 중 cancellation point에서 자신이 cancel되었는지를 확인하는 함수는 pthread_testcancel()입니다. 7. 각 쓰레드마다 제공되는 자원은 레지스터 정보(hardware context)와 stack입니다. 8. 각 thread에서 사용되는 모든 함수에 접근 가능한 data를 저장하는 공간을 thread local storage라고 부릅니다. 9. local variable만을 사용하는 library function은 mt-safe합니다. 10. thread 간에 데이터 교환을 위해서는 변수의 값보다 변수의 주소를 전달하는 것이 안전합니다.
  • 3. Deadlock
    1. 다음 두 프로세스는 deadlock 상태에 빠질 수 없습니다. 2. deadlock이 발생할 필요 조건이 아닌 것은 3) no preemption입니다. 3. banker algorithm은 deadlock prevention 기법이 아닙니다. 4. resource allocation graph에 cycle이 발생하면 deadlock이 발생한 것입니다. 5. resource에 ordering을 적용하여, 자신이 소유한 resource보다 높은 번호의 resource만을 요청할 수 있도록 하는 방법은 deadlock 조건 중 circular wait를 위배시키는 방법입니다. 6. 주어진 상태는 safe하지 않으므로 safe sequence는 0입니다. 7. 틀린 말은 5) semaphore는 CPU 싸이클을 낭비하는 방법이다입니다. 8. 주어진 동작에 해당하는 semaphore 오퍼레이션은 S_wait()입니다. 9. 주어진 세마포어 구현 코드에서 빠진 부분은 wakeup(P)입니다. 10. semaphore 오퍼레이션 S_wait 함수 내부에서 불리는 system call은 block입니다.
  • 4. Memory Management (1)
    1. page size가 커지면 external fragmentation이 심해집니다. 2. 한 프로세스가 실행 시 생성되는 물리 주소는 실행 시마다 다를 수 있습니다. 3. page size가 커지면 page table의 entry 수도 증가합니다. 4. 프로그램 실행에 필요한 페이지를 먼저 메모리에 적재하여 실행하는 것을 lazy loading이라고 합니다. 5. 한 프로세스를 구성하는 페이지들은 물리 메모리에 연속적으로 할당되어야 합니다. 6. 주어진 page table 정보에 따르면, 가상주소 0x000071A0에 대응하는 물리 주소는 0x321A0입니다. 7. 32비트 가상주소, 1KB 크기의 페이지를 사용하는 시스템이 64개의 물리 프레임에서 동작한다면, 물리주소는 16비트입니다. 8. 서로 다른 프로세스들이 물리 메모리 프레임을 공유할 수 있습니다. 9. 프로세스 a의 주소 0x1000번지와 프로세스 b의 주소 0x1000번지는 같은 물리주소를 공유하지 않습니다. 10. Variable partitioning 기법에서 현재 필요한 크기보다 훨씬 큰 영역에 프로세스를 배치하는 방법을 worst-fit이라고 부릅니다. 11. 가상주소의 크기(bit 수)와 물리주소의 크기는 동일할 필요가 없습니다.
  • 5. Memory Management (2)
    1. CPU가 페이지에 접근했을 때 해당 페이지가 메모리에 적재되지 않은 상황을 page fault라고 합니다. 2. 주어진 코드에서 변수 i, sum에 대한 반복적 접근 성질을 temporal locality라고 합니다. 3. 주어진 page table 정보에 따르면, 가상주소 0x000051A0에 대응하는 물리 주소는 0x301A0입니다. 4. 32비트 가상주소, 1KB 크기의 페이지를 사용하는 시스템이 64개의 물리 프레임에서 동작한다면, 물리주소는 20비트입니다. 5. address translation의 고속화를 위해 하드웨어 주소 캐쉬가 사용되는데, 이를 TLB라고 부릅니다. 6. 32-bit 가상 주소 시스템에서 2-level 4KB 페이징을 사용하고 outer index가 10-bit라면, 한 개의 outer index가 가리키는 페이지 테이블은 1024개의 PTE를 갖습니다. 7. segmentation 기법의 장점이 아닌 것은 3) Internal fragmentation since segments vary in length, memory allocation is a dynamic storage-allocation problem입니다. 8. inverted paging 기법에서는 한 개의 page table은 모든 process들이 공유합니다. 9. 주어진 컴퓨터 시스템에서 한 개의 데이터에 접근하는데 걸리는 평균 memory access time은 107ns입니다.
  • 6. Virtual Memory Management
    1. 페이지 교체 전략 중 접근(access) 시간이 가장 오래된 페이지 프레임을 교체하는 방법은 LRU입니다. 2. 시스템에 프로세스가 급증했을 때, 프로세스 페이지의 swap-out, swap-in이 반복되는 현상은 thrashing입니다. 3. 주어진 페이지 참조 패턴에서 t1에서의 working set은 1, 5, 6, 7입니다. 4. 주어진 코드에서 배열 A에 적용되는 접근 성질을 spatial locality라고 합니다. 5. LRU 기법의 approximate 구현 방법으로서, 페이지들을 시계방향으로 순회하며 reference bit를 확인하는 방식을 second chance 방법이라고 합니다. 6. page table의 dirty bit는 페이지 내에 결함이 있음을 나타내지 않습니다. 7. shared memory는 각 프로세스마다 동일한 가상 주소에 매핑되지 않습니다. 8. 서로 다른 프로세스들이 물리 메모리 프레임을 공유할 수 있습니다. 9. 부모 프로세스에 의해 fork된 자식 프로세스는 초기에 부모와 동일한 페이지 테이블을 갖습니다. 10. 프로세스가 상속받은 페이지는 해당 페이지에 write가 일어날 때 비로소 새 물리 프레임을 할당받는 방식을 copy on write 기법이라고 부릅니다. 11. memory-mapped file 기법의 장점이 아닌 것은 3) Process has less control over data movement입니다.
  • 7. File System
    1. file system의 protection 기법 중에서 각 object마다 사용자들의 접근권한을 설정하는 방법은 ACL입니다. 2. capability는 자신의 권한을 타 사용자(또는 프로세스)에게 양도할 수 있습니다. 3. 현재 Linux 에서 사용하는 protection 기법은 capability가 아닙니다. 4. 파일 전체 단위로 lock을 거는 함수는 flock입니다. 5. 리눅스에서 각 파일의 메타 데이터를 저장하는 자료 구조는 inode입니다. 6. modified contiguous allocation 방법은 초기의 블럭 할당 후에, 추가적인 공간이 필요할 때 extent를 제공합니다. 7. Linked allocation은 각 블럭의 끝에 다음 블럭 번호를 기록하는 방법이며, 이를 개선한 방법이 FAT입니다. 8. 블럭의 크기가 2KB, 블럭 번호(포인터)가 4 바이트인 파일 시스템에서, i-node에서 single indirect 블럭이 가리킬 수 있는 최대 블럭 갯수는 512개입니다. 9. 디스크의 free block 관리 방법으로 각 블럭의 사용 상태를 1 bit으로 표현하는 방법을 bitmap 또는 bit vector라고 합니다. 10. free 블럭 관리 방법에서 각 블럭 내에 n개의 free 블럭을 기록하는 방법을 counting 방법이라고 하지 않습니다. 11. Linux 시스템에서 파일 시스템의 consistency를 체크하는 프로그램 명은 fsck입니다. 12. 리눅스 파일시스템에서 한 파일의 i-node를 다른 파일이 가리킬 수 있는데, 이 파일을 hard link라고 합니다.
Easy AI와 토픽 톺아보기
  • 1. Process Synchronization
    Process synchronization is a fundamental concept in operating systems that ensures the correct and efficient execution of concurrent processes. It involves coordinating the access to shared resources, preventing race conditions, and ensuring that processes do not interfere with each other's execution. Proper synchronization mechanisms, such as locks, semaphores, and monitors, are crucial for maintaining data integrity, avoiding deadlocks, and ensuring the overall reliability of the system. Understanding and implementing effective synchronization techniques is essential for designing robust and scalable concurrent systems, particularly in areas like multi-threaded programming, distributed systems, and real-time applications. The challenges in process synchronization include ensuring fairness, avoiding starvation, and balancing performance and correctness. Ongoing research in this area explores new synchronization primitives, adaptive algorithms, and formal verification techniques to address these challenges and further improve the reliability and efficiency of concurrent systems.
  • 2. Thread
    Threads are a fundamental concept in modern operating systems, providing a way to achieve concurrency and parallelism within a single process. Threads share the same memory space and resources, allowing for efficient communication and data sharing, but they also introduce challenges in terms of synchronization and resource management. The benefits of using threads include improved responsiveness, better utilization of system resources, and the ability to take advantage of multi-core architectures. However, the complexity of thread-based programming, potential for race conditions, and the risk of deadlocks require careful design and implementation. Effective use of synchronization primitives, such as locks, semaphores, and condition variables, is crucial for ensuring the correctness and performance of multi-threaded applications. Additionally, the scheduling of threads by the operating system, the management of thread-local storage, and the handling of thread-specific exceptions are important considerations. Ongoing research in this area explores new thread models, scheduling algorithms, and programming abstractions to further enhance the usability and efficiency of threads in a wide range of applications.
  • 3. Deadlock
    Deadlock is a critical issue in concurrent systems, where two or more processes or threads are blocked indefinitely, waiting for resources held by each other. Deadlocks can lead to system starvation, unresponsiveness, and even complete system failure if not properly addressed. Understanding the necessary conditions for deadlock, such as mutual exclusion, resource holding, no preemption, and circular wait, is crucial for designing systems that can effectively prevent or detect and resolve deadlocks. Techniques like resource ordering, deadlock detection algorithms, and deadlock avoidance strategies (e.g., resource allocation graphs, banker's algorithm) are important tools in the operating system's arsenal to mitigate the risks of deadlock. Additionally, the development of formal verification methods and model checking approaches can help identify and analyze potential deadlock scenarios during the design phase. Ongoing research in this area explores new deadlock prevention and resolution mechanisms, as well as the integration of deadlock management into programming languages and runtime environments. Effectively addressing deadlock is essential for ensuring the reliability and availability of complex, concurrent systems.
  • 4. Memory Management (1)
    Memory management is a critical function of an operating system, responsible for efficiently allocating and managing the available physical memory resources. The primary goals of memory management include providing each process with the illusion of having exclusive access to a contiguous address space, while also ensuring efficient utilization of the underlying hardware. Key concepts in memory management include virtual memory, paging, segmentation, and memory protection. Virtual memory allows processes to access a larger logical address space than the available physical memory, using techniques like paging and demand paging to bring in required memory pages on-the-fly. Segmentation provides a way to organize the address space into logical units, while memory protection mechanisms ensure that processes cannot access or modify memory regions they are not authorized to access. The design and implementation of these memory management techniques involve trade-offs between performance, memory utilization, and complexity. Ongoing research in this area explores new memory management algorithms, hardware-software co-design, and techniques to improve energy efficiency and security in memory systems. Effective memory management is crucial for the overall performance and reliability of modern computer systems.
  • 5. Memory Management (2)
    The second aspect of memory management in operating systems involves the dynamic allocation and deallocation of memory for processes and their associated data structures. This includes techniques like heap management, dynamic memory allocation, and garbage collection. Heap management provides a way for processes to request and release memory blocks of varying sizes, while dynamic memory allocation algorithms (e.g., first-fit, best-fit, worst-fit) aim to efficiently satisfy these requests and minimize fragmentation. Garbage collection, on the other hand, is a mechanism for automatically reclaiming memory occupied by objects that are no longer in use, relieving the programmer from the burden of manual memory deallocation. The design of these memory management subsystems must balance factors such as performance, memory utilization, and ease of use for application developers. Challenges in this area include handling memory leaks, optimizing memory allocation and deallocation, and integrating garbage collection with programming language runtimes. Ongoing research explores new memory allocation algorithms, adaptive memory management techniques, and the integration of memory management with hardware features (e.g., NUMA, memory hierarchies) to further improve the efficiency and reliability of memory management in modern computer systems.
  • 6. Virtual Memory Management
    Virtual memory management is a fundamental concept in modern operating systems that provides processes with the illusion of having a large, contiguous address space, while the underlying physical memory may be fragmented or smaller than the logical address space. The key mechanisms behind virtual memory management include paging, page replacement algorithms, and memory protection. Paging divides the logical address space into fixed-size pages, which are mapped to physical page frames in memory. Page replacement algorithms, such as LRU (Least Recently Used) and CLOCK, determine which pages should be evicted from memory when new pages need to be brought in. Memory protection mechanisms, such as page table entries and access control bits, ensure that processes can only access the memory regions they are authorized to access, preventing unauthorized access and maintaining system integrity. Virtual memory management also enables features like demand paging, where pages are loaded into memory only when they are accessed, and copy-on-write, which optimizes memory usage for shared pages. Ongoing research in this area explores new page replacement algorithms, hardware-software co-design for virtual memory, and techniques to improve the energy efficiency and security of virtual memory systems. Effective virtual memory management is crucial for the performance, scalability, and reliability of modern computer systems.
  • 7. File System
    The file system is a critical component of an operating system, responsible for organizing, storing, and managing files and directories on storage devices. Effective file system design is essential for providing users and applications with a reliable and efficient way to access and manipulate data. Key aspects of file system management include file organization and naming, directory structures, file metadata (e.g., permissions, timestamps), and storage allocation strategies. File systems also need to handle operations like file creation, deletion, read, write, and seek, as well as support features like file locking, journaling, and backup/restore mechanisms. The choice of file system type (e.g., FAT, NTFS, ext4, ZFS) depends on factors such as performance, scalability, reliability, and the specific requirements of the operating system and its users. Ongoing research in file systems explores new techniques for improving metadata management, enhancing data integrity and security, optimizing storage utilization, and integrating file systems with emerging storage technologies (e.g., solid-state drives, object storage). Effective file system design and management is crucial for the overall usability, performance, and reliability of computer systems.
주제 연관 리포트도 확인해 보세요!