Skip to main content

Posts

Featured

sarath

 #include <stdio.h> #include <unistd.h> #include <sys/types.h> int main() {     pid_t pid;     // Create a new process     pid = fork();     if (pid < 0) {         // Error occurred         perror("fork failed");         return 1;     } else if (pid == 0) {         // Child process         printf("This is the child process. PID: %d\n", getpid());     } else {         // Parent process         printf("This is the parent process. PID: %d, Child PID: %d\n", getpid(), pid);     }     return 0; } ------------------------------------------------------------ #include <stdio.h> #include <pthread.h> #include <semaphore.h> #include <unistd.h> 3 Γ #define N 5 L sem_t forks[N]; pthread_t phil[N]; int id[N]; void* dine(void* arg) { in...

Latest posts

os10

dbms lab