Solved

Process related question

Posted on 2004-08-25
8
247 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 62

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
Gigs: Get Your Project Delivered by an Expert

Select from freelancers specializing in everything from database administration to programming, who have proven themselves as experts in their field. Hire the best, collaborate easily, pay securely and get projects done right.

 
LVL 45

Expert Comment

by:sunnycoder
ID: 11900078
Hi Arut,

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

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

Gigs: Get Your Project Delivered by an Expert

Select from freelancers specializing in everything from database administration to programming, who have proven themselves as experts in their field. Hire the best, collaborate easily, pay securely and get projects done right.

Question has a verified solution.

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

Introduction Regular patching is part of a system administrator's tasks. However, many patches require that the system be in single-user mode before they can be installed. A cluster patch in particular can take quite a while to apply if the machine…
I promised to write further about my project, and here I am.  First, I needed to setup the Primary Server.  You can read how in this article: Setup FreeBSD Server with full HDD encryption (http://www.experts-exchange.com/OS/Unix/BSD/FreeBSD/A_3660-S…
Learn how to navigate the file tree with the shell. Use pwd to print the current working directory: Use ls to list a directory's contents: Use cd to change to a new directory: Use wildcards instead of typing out long directory names: Use ../ to move…
In a previous video, we went over how to export a DynamoDB table into Amazon S3.  In this video, we show how to load the export from S3 into a DynamoDB table.

786 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