LinuxQuestions.org
Latest LQ Deal: Latest LQ Deals
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 02-17-2019, 08:00 PM   #1
Yuc
Member
 
Registered: Nov 2018
Posts: 38

Rep: Reputation: Disabled
How the virtual address was decided(allocated) when the system start(fork) a new process?


Let say the system starts two processes A and B. How the virtual address of process A and process B was allocated?


Thank you.

Last edited by Yuc; 02-17-2019 at 08:00 PM. Reason: spelling mistakes
 
Old 02-17-2019, 08:43 PM   #2
frankbell
LQ Guru
 
Registered: Jan 2006
Location: Virginia, USA
Distribution: Slackware, Ubuntu MATE, Mageia, and whatever VMs I happen to be playing with
Posts: 19,378
Blog Entries: 28

Rep: Reputation: 6163Reputation: 6163Reputation: 6163Reputation: 6163Reputation: 6163Reputation: 6163Reputation: 6163Reputation: 6163Reputation: 6163Reputation: 6163Reputation: 6163
This looks like a homework question.

If so, please show us some of the work you've done to answer it before you turned to LQ for assistance.
 
Old 02-18-2019, 01:00 AM   #3
Yuc
Member
 
Registered: Nov 2018
Posts: 38

Original Poster
Rep: Reputation: Disabled
Oh,sorry! It's not a homework question,but it may seem to be.
I am read the book-<the design of the unix operating system>,and now I have reached the chapter6.
In chapter6 the author says the virtual address space of a process into logical regions.But the author didn't give much detail about it.
So I just wonder how the system decides what virtual address space to give the new process when starts it.
 
Old 02-18-2019, 07:10 AM   #4
ehartman
Senior Member
 
Registered: Jul 2007
Location: Delft, The Netherlands
Distribution: Slackware
Posts: 1,674

Rep: Reputation: 888Reputation: 888Reputation: 888Reputation: 888Reputation: 888Reputation: 888Reputation: 888
Quote:
Originally Posted by Yuc View Post
So I just wonder how the system decides what virtual address space to give the new process when starts it.
The virtual address space is what the linker (ld) compiled into the executable.
The physical addresses (and it doesn't have to be a single space) is where the kernel can find room in the current RAM usage to load one or more pages OF the executable.
But that's invisible to the application itself.
PS: even malloc's will return virtual address values, that is, addresses that the program can use TO access the newly allocated memory. Again: the program doesn't need to know where in RAM this memory has been found.
The physical address of a page may even vary during the execution of the program.
 
1 members found this post helpful.
Old 02-18-2019, 09:08 PM   #5
frankbell
LQ Guru
 
Registered: Jan 2006
Location: Virginia, USA
Distribution: Slackware, Ubuntu MATE, Mageia, and whatever VMs I happen to be playing with
Posts: 19,378
Blog Entries: 28

Rep: Reputation: 6163Reputation: 6163Reputation: 6163Reputation: 6163Reputation: 6163Reputation: 6163Reputation: 6163Reputation: 6163Reputation: 6163Reputation: 6163Reputation: 6163
Quote:
I just wonder how the system decides what virtual address space to give the new process when starts it.
Thanks for straightening me out. Clearly, you are digging deep into that material.

I found a page at kernel.org that might be helpful. I can't say for sure, because it made my brain hurt.

https://www.kernel.org/doc/gorman/ht...rstand007.html

Last edited by frankbell; 02-18-2019 at 09:10 PM.
 
1 members found this post helpful.
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Finding the end address of virtual memory allocated to a process me011089 Linux - Newbie 1 06-17-2015 07:36 PM
Can I fork a foreground child process in a background process? henryyao Linux - Newbie 1 09-06-2013 03:32 PM
Under which circumstances a child process creates another child process using fork? mitsulas Programming 3 12-08-2009 08:16 AM
releasing memory allocated to a process aloktiagi Linux - Newbie 1 08-25-2009 06:56 AM
how to get my ip address allocated by dhcp on dsl paledread Linux - Networking 2 03-09-2004 06:50 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 04:29 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration