Thursday, 26 December 2013

OS ASSIGNMENT-SEC-E / memory management

                                                            OS ASSIGNMENT
                                                                                              - GAJJAR PREMAL

                                                                         E

E.Memory management:
E.1 Basic commands:


1. top

(1) VIRT

VIRT -- Virtual Image (kb)
The total amount of virtual memory used by the task. It
includes all code, data and shared libraries plus pages that
have been swapped out and pages that have been mapped but not
used.
VIRT = SWAP + RES


(2) SWAP

SWAP -- Swapped size (kb)
The swapped out portion of a task’s total virtual
memory image.


(3) RES

Resident size (kb). (ps −aly).
The non−swapped physical memory a task has used.
RES = CODE + DATA


(4) CODE

Code size (kb)
The amount of physical memory devoted to executable code, also known as the
’text resident set’ size or TRS.


(5) DATA

Data+Stack size (kb)
The amount of physical memory devoted to other than executable code, also
known as the data resident set’ size or DRS.


(6) SHR

Shared Mem size (kb)
The amount of shared memory used by a task. It simply reflects memory that
could be potentially shared with other processes.


(7) nFLT

Page Fault count
The number of major page faults that have occurred for a task. A page fault
occurs when a process attempts to read from or write to a virtual page that is not
currently present in its address space. A major page fault is when backing
storage access (such as a disk) is involved in making that page available.


(8) nDRT

Dirty Pages count
The number of pages that have been modified since they were last written to disk.
Dirty pages must be written to disk before the corresponding physical memory
location can be used for some other virtual page.

2. size, objdump, nm:
Compile the following program with
gcc −Wall size.c


(1) What does the 7365 mean?

Ans :
The size in 7365 bytes. you may modify this by using the -h option
together with -lah this will have the output in k,M,G for a better
understanding.


(2) What do the 1097, 280, 4, and 1381?

Ans :
This displays the size in bytes of the executable a.out file. The
size of each section of the object file is given, followed by the
total:
1097 + 280 + 4 = 1381
text - is my code, vector table plus constants, shows the code and
read-only data in application (in decimal)

data - is for initialized variables, and it counts for RAM and FLASH. The
linker allocates the data in FLASH which then is copied from ROM to RAM
in the startup code.

shows the read-write data in your application (in decimal)
bss - is for the uninitialized data in RAM which is initialized with zero in
the startup code.
show the zero initialized ('bss' and 'common') data in your application (in
decimal)
dec - total of 'text' + 'data' + 'bss' (in decimal)
hex - hexidecimal equivalent of 'dec'
typically ,

• the flash consumption of your application will then be text + data
• the RAM consumption of your application will then be data + bss.

No comments: