Complete the code to create a new process using fork.
pid = [1]()The fork() system call creates a new process by duplicating the calling process.
Complete the code to replace the current process image with a new program using exec.
exec[1]("/bin/ls", "ls", "-l", NULL);
The execl() function replaces the current process image with a new program, taking the program path and arguments as a list.
Fix the error in the code to correctly create a child process and run a new program.
pid = fork(); if (pid == 0) { [1]("/bin/echo", "echo", "Hello", NULL); } else { wait(NULL); }
Inside the child process (pid == 0), execl() replaces the process image with the new program.
Fill both blanks to create a dictionary comprehension that maps process IDs to their status if the status is 'running'.
{pid: status for pid, status in processes.items() if status [1] [2]The comprehension filters processes where the status is exactly "running" using the equality operator ==.
Fill all three blanks to create a dictionary comprehension that maps uppercase process names to their IDs if the ID is greater than 1000.
{ [1]: [2] for [3], name in process_list if [3] > 1000 }The comprehension maps the uppercase process name (name.upper()) to the process ID (pid) for IDs greater than 1000.