hoon

fork(), sched_setaffinity() 그리고 성능 측정에 관하여.. 본문

Operating Systems

fork(), sched_setaffinity() 그리고 성능 측정에 관하여..

hoon123 2021. 3. 18. 19:00

fork()의 성공의 Retrun value는 parent는 child process pid를 반환받고 child는 0을 반환받는다.

(child process pid는 절대로 0이 아니다. 0은 단지 성공에 대한 return value이다.!!)

 

int sched_setaffinity(pid_t pid, size_t cpusetsize,const cpu_set_t *mask)는 cpu코어를 정할 수 있게 해주는 함수이다.

 

설명에 잘 나와있듯이 If pid is zero, then the  calling  thread  is used. 

 

NOTE

....

Specifying  pid as 0 will set the attribute for the calling thread, and passing the value returned from  a  call  to  getpid(2)  will  set  the attribute  for  the main thread of the thread group.

...

0이 아닌 다른값을 넣어주면 thread group의 주 thread에 대한 속성(부수물?)이 설정된다.

 

프로그램 성능 측정 시

너무너무 짧은 시간은 computer님이 제대로 파악을 할 수가 없다...

그래서 여러번 반복한 시간을 측정하여 나눠주는 것이다.(평균을 낸 다음에 정확성의 측면에도 있겠지만) 

자료구조론에 초기에 나오는 내용이다..까먹지말자...

 

대충 코딩하지 말고 다시 한번 찾아보자...

'Operating Systems' 카테고리의 다른 글

Scheduling  (0) 2021.04.10
Virtualization-process  (0) 2021.03.13
운영체제 개요  (0) 2021.03.06
Comments