566 views

1 Answer

5 votes
5 votes

when fork is execute the child process has same virtual address space or physical address space ?

It is virtual address space.

when we print address of a variable in c ..what is it :->virtual address or physical address?

For second part:

It is virtual address.

It depends on what runs your code.  If your code is loaded as a regular application on a operating system, then it will be a virtual address (what you refer to as a 'logical address'). 

If your code is loaded  on plain hardware, without any OS then it may be a physical address -- but only if your operating system is running on a physical machine.  If your operating system is running on a virtual machine, it will always be a virtual address.

Related questions

2 votes
2 votes
2 answers
1
2 votes
2 votes
3 answers
4
Philosophical_Virus asked Dec 10, 2023
885 views
Int main (){fork();printf("a");fork();printf("b");return 0;}How many distinct outputs are possible of above code? And also give outputs