The Eduladder is a community of students, teachers, and programmers just interested to make you pass any exams. So we help you to solve your academic and programming questions fast.
In eduladder you can Ask,Answer,Listen,Earn and Download Questions and Question papers.
Watch related videos of your favorite subject.
Connect with students from different parts of the world.
Apply or Post Jobs, Courses ,Internships and Volunteering opportunity. For FREE
See Our team
Wondering how we keep quality?
Got unsolved questions? Ask Questions

Sixth-Semester-BE-Degree-Examination-JuneJuly-2013-UNIX-System-Programming-->View question


Asked On2017-12-19 15:12:07 by:leo

Taged users:
Salomon-Dalmetnikhil43874

Likes:
Purnima

Dislikes:
Be first to dislike this question
Talk about this  Like  Dislike
View all qusetions
Answers
                                
•An executable program generated by a compiler will have the following organization in memory on a typical architecture (such as on MIPS):

•This is the layout in memory of an executable program.
•Note that in a virtual memory architecture (which is the case for any modern operating system), some parts of the memory layout may in fact be located on disk blocks and they are retrieved in memory by demand (lazily).
•The machine code of the program is typically located at the lowest part of the layout.
•Then, after the code, there is a section to keep all the fixed size static data in the program.
•The dynamically allocated data (ie. the data created using malloc in C) as well as the static data without a fixed size (such as arrays of variable size) are created and kept in the heap. The heap grows from low to high addresses.
•When you call malloc in C to create a dynamically allocated structure, the program tries to find an empty place in the heap with sufficient space to insert the new data; if it can't do that, it puts the data at the end of the heap and increases the heap size.
•The focus of this section is the stack in the memory layout. It is called the run-time stack.
•The stack, in contrast to the heap, grows in the opposite direction (upside-down): from high to low addresses, which is a bit counterintuitive. The stack is not only used to push the return address when a function is called, but it is also used for allocating some of the local variables of a function during the function call, as well as for some bookkeeping.
Activate Record
•It is used to store the current record and the record is been stored in the stack.
•It contains return value .After the execution the value is been return.
•It can be called as return value.
Parameter
•It specifies the number of parameters used in functions.
Local Data
•The data that is been used inside the function is called as local address
Temporary Data
•It is used to store the data in temporary variables.
Links
•It specifies the additional links that are required by the program.
Status
•It specifies the status of program that is the flag used.


Storage Allocation
Runtime environment manages runtime memory requirements for the following entities:
Code: It is known as the text part of a program that does not change at runtime. Its memory requirements are known at the compile time.
Procedures: Their text part is static but they are called in a random manner. That is why, stack storage is used to manage procedure calls and activations.
Variables: Variables are known at the runtime only, unless they are global or constant. Heap memory allocation scheme is used for managing allocation and de-allocation of memory for variables in runtime.
Static Allocation
In this allocation scheme, the compilation data is bound to a fixed location in the memory and it does not change when the program executes.
As the memory requirement and storage locations are known in advance, runtime support package for memory allocation and de-allocation is not required.
In a static storage-allocation strategy, it is necessary to be able to decide at compile time exactly where each data object will reside at run time. In order to make such a decision, at least two criteria must be met:

Dynamic Allocation
The allocation can be varied during the execution
It makes the use of recursive function.
In a dynamic storage-allocation strategy, the data area requirements for a program are not known entirely at compilation time.
In particular, the two criteria that were given in the previous section as necessary for static storage allocation do not apply for a dynamic storage-allocation scheme.
The size and number of each object need not be known at compile time; however, they must be known at run time when a block is entered.
Similarly more than one occurrence of a data object is allowed, provided that each new occurrence is initiated at run time when a block is entered.
Stack Allocation
Procedure calls and their activations are managed by means of stack memory allocation.
It works in last-in-first-out (LIFO) method and this allocation strategy is very useful for recursive procedure calls.
Heap Allocation
Variables local to a procedure are allocated and de-allocated only at runtime.
Heap allocation is used to dynamically allocate memory to the variables and claim it back when the variables are no more required.
Except statically allocated memory area, both stack and heap memory can grow and shrink dynamically and unexpectedly.
Therefore, they cannot be provided with a fixed amount of memory in the system.

As shown in the image above, the text part of the code is allocated a fixed amount of memory.
Stack and heap memory are arranged at the extremes of total memory allocated to the program. Both shrink and grow against each other


Answerd on:2018-06-06 Answerd By:aksingh1818

Likes:
|aksingh1818

Dislikes:
Be first to dislike this answer
Talk about this  Like  Dislike

Stay home and watch eduladder premium videos for free In at this qurentine.


You might like this video:Watch more here

Watch more videos from this user Here

Learn how to upload a video and start earning here



Lets together make the web is a better place

We made eduladder by keeping the ideology of building a supermarket of all the educational material available under one roof. We are doing it with the help of individual contributors like you, interns and employees. So the resources you are looking for can be easily available and accessible also with the freedom of remix reuse and reshare our content under the terms of creative commons license with attribution required close.

You can also contribute to our vision of "Helping student to pass any exams" with these.
Answer a question: You can answer the questions not yet answered in eduladder.How to answer a question
Career: Work or do your internship with us.Work with us
Create a video: You can teach anything and everything each video should be less than five minutes should cover the idea less than five min.How to upload a video on eduladder