NPTLTGI - NPTL TGI concept POSIX thread specification...

Info iconThis preview shows pages 1–3. Sign up to view the full content.

View Full Document Right Arrow Icon
NPTL TGI concept POSIX thread specification specifies that threads created from a process should share same process id. Native LinuxThread does not comply with this specification. NPTL (Native POSIX Thread Library) does not comply with this specification but introduced Task group ID to make it close to the required specification. See the following links to get to know more about POSIX threads. http://linux.die.net/man/7/pthreads https://computing.llnl.gov/tutorials/pthreads/ fork_pt.c #include <sys/types.h> #include <unistd.h> #include <stdio.h> #include <stdlib.h> #include <linux/unistd.h> int main(void) { int pid; printf("before fork\n\n"); if((pid = fork()) < 0){ printf("fork error\n"); exit(-2); }else if (pid == 0){ printf("TGID(%d), PID(%d) : Child\n", getpid(), syscall(__NR_gettid)); }else{ printf("TGID(%d), PID(%d) : Parent\n", getpid(), syscall(__NR_gettid)); sleep(2); } printf("after fork\n\n"); return 0; } pthread_pt.c #include <sys/types.h>
Background image of page 1

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
#include <unistd.h>
Background image of page 2
Image of page 3
This is the end of the preview. Sign up to access the rest of the document.

This note was uploaded on 03/01/2012 for the course CMP 426 taught by Professor Gwangs.jung during the Spring '12 term at CUNY Lehman.

Page1 / 3

NPTLTGI - NPTL TGI concept POSIX thread specification...

This preview shows document pages 1 - 3. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online