Unix Programming - heap allocation & kill signal

This is Interesting: Free IT Magazines  
Home > Archive > Unix Programming > January 2007 > heap allocation & kill signal





You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

Author heap allocation & kill signal
gaurish.panse@gmail.com

2007-01-23, 7:31 am

1. How does the OS (*nix) keeps track of the heap memory allocated to
each
process? If the OS knows the memory consumed by each process, does it
automatically releases the memory upon process termination/kill? if
not, why not ?

2. What happens when SIGKILL is issued on a process? What clean up the
OS does?

TIA

~ gau

Pascal Bourguignon

2007-01-23, 7:31 am

gaurish.panse@gmail.com writes:

> 1. How does the OS (*nix) keeps track of the heap memory allocated to
> each
> process? If the OS knows the memory consumed by each process, does it
> automatically releases the memory upon process termination/kill? if
> not, why not ?
>
> 2. What happens when SIGKILL is issued on a process? What clean up the
> OS does?


Quite interesting questions. You'll learn a great deal answering them...

You can either read some books, there are very good unix books,
or read the sources of some unix kernel. You've got the choice between
a number of them, ranging from linux, freebsd and other *bsd, minix,
mach, etc. I assume you're able to find these sources on the web...

--
__Pascal Bourguignon__ http://www.informatimago.com/

"By filing this bug report you have challenged the honor of my
family. Prepare to die!"
SM Ryan

2007-01-24, 7:19 pm

gaurish.panse@gmail.com wrote:
# 1. How does the OS (*nix) keeps track of the heap memory allocated to
# each
# process? If the OS knows the memory consumed by each process, does it
# automatically releases the memory upon process termination/kill? if
# not, why not ?

The system knows all pages in your virtual memory. The simplest and
oldest way to extend the data segment is the break value (brk() or
sbrk()). Unices are also now offering more direct control for VM maps.
A process's pages are released when it exits, but those pages might
be shared and remain with other processes. IPC shared memory segments
remain until deleted.

# # 2. What happens when SIGKILL is issued on a process? What clean up the
# OS does?

It does something akin to forcing an _exit call.

--
SM Ryan http://www.rawbw.com/~wyrmwif/
The whole world's against us.
Sponsored Links






Free braindumps | Software forum | Database administration forum

Copyright 2003 - 2008 webservertalk.com