E D R , A S I H C RSS

쓰레드에관한잡담

process scheduling .
1. real-time process - 1.hard real-time(), 2.soft real-time(vedio decoder )
2. time-sharing process


time-sharing .
Linux thread .
1. Kernel - 1. Kernel Thread, 2. LWT(Lightweight Thread)
2. User Thread


thread , context switch thread .
Linux fork() do_fork() Kernel 함, do_fork() user thread POSIX Mutex .


... ... 한... POSIX thread thread .
. . .
... mutex 화... ... lock context switch .



... context switch PCB(Process Control Block) .
Assembly .
PCB process .
-> Zombie Process PCB .

~cpp 
void *thread(void *arg)
{
        int num = *(int *)arg;
        int i;

        for(i=1; i<=20; i++){
                pthread_mutex_lock(&mutex);
                printf("%d: sum+=%d\n", num, i);
                sum += i;
                sleep(1);
                pthread_mutex_unlock(&mutex);
        }
}

thread 10     행하,
함  context switch  arg    .
arg 0~9      .

pthread_mutex_lock    arg 0 .
   pthread   .
확한   arg    . .

Critical Section .
.
argument .
function argument stack , stack . .
Valid XHTML 1.0! Valid CSS! powered by MoniWiki
last modified 2021-02-07 05:30:19
Processing time 0.0152 sec