answersLogoWhite

0


Best Answer

Each process uses memory regions for different purposes and we give these regions different labels to identify them.

At the lowest level is static memory. This is where all the program's constants, static variables and global variables are stored. This area is initialised from information stored in the program's data segment and this region is usually allocated close to the program's text segment (the executable code). Static memory is fixed size.

Every thread in a process requires its own stack. Thus every program has at least one stack. Stacks are allocated at the top of the address space and are fixed size. The thread's stack pointer keeps track of the top of the stack, thus memory can be quickly allocated and released simply by adjusting the stack pointer. A thread's stack is used to store function return addresses, function arguments and local variables, exception handlers and return values.

All other (unused) memory between the static memory and the stacks is known as the heap or free store. The heap is used to dynamically allocate and release memory as and when required and is particularly useful for storing large data structures that are either too large to allocate on the stack or have variable length and are therefore unsuitable to be stored in static memory. Either static memory or the stack must be used to keep track of dynamic memory allocations, but once memory is allocated on the heap it can be used to keep track of further dynamic allocations. It is often useful to provide your own dynamic memory manager to allocate regions of memory that can then be used to store dynamic structures, and thus keep the number allocation/deallocation operations to a minimum. Once memory has been allocated, there is no performance difference between the separate regions since all regions use the exact same memory hardware. The only cost is in allocating (or deallocating) memory because each allocation (or deallocation) requires an operating system request. By allocating chunks of memory rather than on an as-required basis, you improve performance.

User Avatar

Wiki User

8y ago
This answer is:
User Avatar

Add your answer:

Earn +20 pts
Q: Why is a process address space divided into multiple regions?
Write your answer...
Submit
Still have questions?
magnify glass
imp
Continue Learning about Engineering

Why use multiple processes instead of multiple threads?

You use a process when you want a separate program, and a thread when you want to asynchronously execute some different code contained within the same program.A process is an address space containing instructions, data, stack, etc. It represents one load module (or program) loaded into memory, ususally by the operating system's exec or equivalant call.There can be more than one process loaded from the same load module. They are separate and distinct, even though they might share regions of instructions and constant data. As an example, the execution of ksh (in linux) or cmd (in windows) represents a process.While executing, a process can invoke another process, either a copy of itself or a different one. For example, ksh can invoke ls, and cmd can invoke explorer. Keep in mind that this is still a different address space. In the case of linux, the process actually makes a copy of itself (fork) and then overlays itself with the new load module.A thread, on the other hand is an execution path through a process. Every process has at least one thread, which starts with the first instruction it executes after being loaded, and ends with the call to the exit or equivalent operating system call.So, to clarify, what executes is actually called a thread, and the process is just the address space. Different naming conventions do exist - this is the windows (and some other OS's) convention.{Restating from three paragraphs before} While executing, a thread can load another process, either a copy of its containing process or a different one, or it can invoke a new thread within itself. While the difference might seem slight, it is not, because the (now two) threads share the same address space, and they can easily communicate with each other, assuming appropriate synchronization is used.In the case of linux, you could say that a separate process is started as fork followed by overlay, while a new thread started as fork without the overlay.Each thread has its own copy of its local variables, and a copy of the invoking parameters. In the simple case, that is sufficient. In the more complex case, involving explicitly allocated heap memory, either different heaps are used, or a mechanism for synchronized sharing is implemented.


What causes internal fragmentation?

External fragmentation is the phenomenon in which free storage becomes divided into many small pieces over time.[1] It is a weakness of certain storage allocation algorithms, occurring when an application allocates and deallocates ("frees") regions of storage of varying sizes, and the allocation algorithm responds by leaving the allocated and deallocated regions interspersed.


What is some regions that use very small technology?

some is Ireland and Mississippi


How many doped regions in a Bipolar transistor?

3: emitter, base, collectorThere are three regions but to be absolutely picky I think only two of them need be doped.Nope: they MUST be doped NPN or PNP. If any are undoped it will not function as a transistor.


What states make up the gulf coast regions?

Texas, Louisiana, Mississippi, Alabama and Florida.

Related questions

How many regions in Asia?

Asia is divided into 5 regions.


How many regions is the pharynx divided into?

It is divided into three anatomical regions


How many regions is Asia divided into?

Asia is commonly divided into six regions: East Asia, Southeast Asia, South Asia, Central Asia, Western Asia (or the Middle East), and Northern Asia.


Does Brazil have multiple regions?

Brazil has multiple regions spread out all over the country


Is France divided in to regions?

France is divided into 22 regions (plus four more oversea regions). Most of these regions are themselves divided into smaller administrative areas, the 'départements'


Why is Canada sometimes divided into physical regions?

It is a huge country, naturally it will be divided into physical regions.


Is Japan divided into provinces states or regions?

Japan is divided into regions and further subdivided into prefectures.


Do America have an regions?

Yes. It is divided into 5 regions.


Is Spain broken up into states?

Spain is divided into both provinces and regions. See the related links for listings.


What are the different ways the US can be divided into regions?

the regions are west


Is France divided into provinces states or regions?

France is divided into regions, but these regions are modelled after the provinces of the old regime, before the French revolution.


When you Visualize 2 distinct points on a line. The points divide the line into separate regions. How many distinct regions is the line divided into?

It is divided into three regions.