본문 바로가기

CS

(4)
[OS]Mutex and Semaphore Synchronization tool software solution: Perterson algorithm hardware : test-and-set compare-and-swap(원자성을 제공하는 struction) 실제는 위와 같은 복잡한 알고리즘으로 짤 수 없다. high-level software tools CSP(critical section problem) 해결법 1. Mutex lock : 가장 간단한 동기화 방법. 2개의 process 제어 2. Semaphore : 가장 보편적, n개의 process 제어, 편리하교 효과적 3. Monitor : Semaphore와 Mutex 단점들 보완, java에서 사용하는 locking 으로 wait & notifying ->mutual exclus..
[알고리즘]Sort Sort(정렬) 1.Selection Sort(선택정렬) : 가장 작은 것을 선택하여 앞으로 보내는 알고리즘 (1) 주어진 배열에서 최솟값을 찾는다. : list[i]~ list[n-1] 크기 비교 (2) 그 값을 맨 앞에 위차한 값과 교체 : list[i] list[j] 자리 바꿈 (3) 반복 시간 복잡도: O(N^2) = O(N)*O(N) 공간 복잡도: O(N) O(1) = 하나의 배열 안에서 swap을 통해 정렬 수행 void selectionSort(int *list, const int n) { int i, j, indexMin, temp; for (i = 0; i < n - 1; i++) { indexMin = i; for (j = i + 1; j < n; j++) { if (list[j] < ..
[OS]Process Synchronization - Monitor Monitor 등장배경 semaphore 사용 시 타이밍(프로그래밍)에러가 자주 발생 problem 예시 mutex 사용 시, process가 wait->signal 순서로 이루어 지지 않고 critical section에 동시에 접근하는 문제가 대부분 sit 1) signal->wait sit 2) wait->wait Monitor란? high level 데이터 형태로 간단한 동기화 tool 프로세스 동기화에 편리하고 효율적인 매커니즘을 제공하는 고도의 추상화된 데이터 형태 -incorporate simple synchronization tools Monitor type - an ADT that includes a set of programmer-defined operations -a high-leve..
[OS]Preview Index 1. Computer system Overview 2. OS Overview 3. System call 4. Process description and control 5. Thread 6. Cpu scheduling 7. Concurrency-Mutual exclusion and synchronization 8. Memory management 9. virtual memory 10. I/O management and disk scheduling Operating System(OS)란? 1.시스템 SW, 프로그램, 자원관리자 - memory, disk space, CPU time, I/O, software 등을 관리 (효율성 극대화) 2. 어플리케이션 개발 환경 제공- 사용자가 프로그램, 어플리..