When a process creates a new process using the fork() operation, which of the following resources is available for read/write between the parent process and the child process?
a) stack
b) heap
c) shared memory segments.
Please explain the answer fully and also explain why the other 2 options are incorrect.
Child and parent run concurrently, parent may create another process and child may also create another porcess. To maintain child process separate stack is maintained by parent and child.
When child process is created, the copy of heap is shared. When a child process performs write on heap, the copy is private to child process. That is not visible to parent process.
When parent process makes some changes , private copy is maintained by parent process and not visible to child process.
Answer is option c
When a process creates a new process using the fork() operation, which of the following resources is available for read/...
Which of the following statements is true regarding the different memory segments for a process and its child process (created using the fork() system call)? 1. Text segment is shared. Data, heap and stack are not shared. 2. Text and data are shared. Heap and stack are not shared. 3. All are shared. 4. None are shared.
Write a program in C using the fork() system call to do the following. The parent process (main program) forks a process (CHILD 1) to compute and print the sum of first n integers where n is a variable shared between the parent and CHILD 1. It also forks another process (CHILD 2) that finds the sum of squares of the first n numbers where n is a variable it shares with the parent. Let CHILD 1 print “The sum...
GIVEN CODE- FILL IN THE
BLANK!
#include <fcntl.h>
#include <unistd.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <sys/wait.h>
// Function ptototypes
int readX();
void writeX(int);
int main() /// chi read x ---> divi ---> write x into file
---> par read x --> sub--> write x into file---> chi
read x-->etc
{
int pid;
// pid: used to keep track of the child
process
int x = 19530; // x:
our value as integer
...
10) Unlike a signal, which conveys only the occurrence of a particular event and contains no information content, a pipe can be thought of as a scratch file created by a system call. It can be used as a communications channel between concurrently running processes. The interface call to a pipe is similar to that for any file. In fact, the process reads and writes to a pipe just like any file. Unlike files, however, pipes do not represent actual...
Operating System a. What is the meaning of the term busy waiting? What other kinds of waiting are there in an operating system? Can busy waiting be avoided altogether? Explain your answers. (5 pts) b. Explain why spinlocks are not appropriate for single-processor systems yet are often used in multiprocessor systems. (5 pts) c. Using the program shown below, explain what the output will be at lines X and Y. Assume that you have a pre-emptive priority system. (10 pts)...
This is for a Unix class.
Please help me out.
I am attaching a skeletal code of the program below, it just
needs ti be filled in.
Below is a skeletal code of the program. Fork a child process and then use the
parent for reading and the child for writing. This is
just a way of sending and receiving messages
asynchronously.
/*
*************************************************************
* Utility functions
* **************************************************************
*/
static void
usageError(const char * progName, const char *msg)
{...
Consider a VEX-executing VLIW machine with the following characteristics: The machine supports 4 slots (4-wide machine) with the following resources: 2 memory units each with a load latency of 3 cycles 2 integer-add/sub functional units with a latency of 2 cycle 1 integer-multiply functional unit with a latency of 4 cycles Each functional unit in the machine is pipelined and can be issued a new operation at each cycle. However, the results of an operation are only available after the...
When faced with a problem, what do you do to solve it? This assignment asks you to apply a six-step to problem solving process to a specific problem scenario. You will write a paper that presents a synthesis of your ideas about solving the problem using this systematic approach. As Voltaire said, "No problem can withstand the assault of sustained thinking." Choose one (1) of the problem scenarios as a topic choice for your paper (Note: Your professor must approve...
1. List some of the various communities to which you belong (organizations, work, hobbies, fields of expertise, family). Give examples of some of the behavioral and language characteristics particular to each group? For instance, do you speak to your job supervisor in the same way you speak to your child or your best friend? Why might you interact with members of different communities differently? 2.What are some of your past experiences with writing? Please explain what you like and...
TRUE/FALSE QUESTIONS: Foundations of Information Security and Assurance 1. There is a problem anticipating and testing for all potential types of non-standard inputs that might be exploited by an attacker to subvert a program. 2. Without suitable synchronization of accesses it is possible that values may be corrupted, or changes lost, due to over-lapping access, use, and replacement of shared values. 3. The biggest change of the nature in Windows XP SP2 was to change all anonymous remote procedure call (RPC)...