Solved

Process related question

Posted on 2004-08-25
8
246 Views
Last Modified: 2010-04-21
Hi all,

Consider the foll. piece of code:

char *p = (1MB) of storage

main()
{

  *p = 200;
  printf(" val = %d", *p)
}

Lets say I get a file a.out which needs to be run.

Please help me understand certain things:
1) how this file would be laid out in memory.
2) Since this would be a file, what filesystem
   related activities would be done (inode ?)
3) Stack allocation and virtual addr. space (conceptual).

In essence I would like to understand the various OS
related actions with reference to a simple program like the above sttored on disk.

Regards,
ASM
0
Comment
Question by:arut
  • 3
  • 2
8 Comments
 
LVL 45

Accepted Solution

by:
sunnycoder earned 125 total points
ID: 11891312
0
 
LVL 61

Assisted Solution

by:gheist
gheist earned 125 total points
ID: 11894670
1) any assumptions about memory layout other than using pointers to access various allocations are at least non-portable, just as you cannot assume that all small allocations are one page in size etc.
2) most systems use rtld (runtime loader, in linux - ld.so) which mmap() s files and libraries into memory, but it does not
3) read (1), stack layout depends on processor
0
 

Author Comment

by:arut
ID: 11899623
Hi All,

I am not making any assumptions, but rather want to understand the concepts. I have a a.out and run it.

What are the actions that the kernel would take?

Regards,
Arut
0
Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

 
LVL 45

Expert Comment

by:sunnycoder
ID: 11900078
Hi Arut,

The link I posted gives all those details. pls check the link
0
 
LVL 61

Expert Comment

by:gheist
ID: 11903144
Any actions that execve() system call does.... (man execve to find out more), described in (2) and not in the checkable link
0
 
LVL 45

Expert Comment

by:sunnycoder
ID: 11911015
ghiest
execve(2) hardly gives any information about memory layout and internals of memory management.

The link does talk about loading code into memory, different segments and paging
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Let's say you need to move the data of a file system from one partition to another. This generally involves dismounting the file system, backing it up to tapes, and restoring it to a new partition. You may also copy the file system from one place to…
My previous tech tip, Installing the Solaris OS From the Flash Archive On a Tape (http://www.experts-exchange.com/articles/OS/Unix/Solaris/Installing-the-Solaris-OS-From-the-Flash-Archive-on-a-Tape.html), discussed installing the Solaris Operating S…
Learn how to find files with the shell using the find and locate commands. Use locate to find a needle in a haystack.: With locate, check if the file still exists.: Use find to get the actual location of the file.:
This video shows how to set up a shell script to accept a positional parameter when called, pass that to a SQL script, accept the output from the statement back and then manipulate it in the Shell.

947 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

22 Experts available now in Live!

Get 1:1 Help Now