Vous êtes sur la page 1sur 9

ADVANCED SYSTEM SOFTWARE CONTENT BEYOND SYLLABUS I

"Fragmented memory" denotes all of the system's unusable free memory. Memory fragmentation usually occurs when memory is allocated dynamically (using calls like malloc). Generally, memory allocation performed during runtime is not in the form of stacks. The memory allocator wastes memory in the following ways:

1. Overhead

2. Internal Fragmentation

3. External Fragmentation.

When blocks of memory are allocated during runtime, it is highly unlikely that these released blocks of memory will again form continuous large memory blocks. Hence, the free memory gets interspersed with the blocks of memory in use. The average size of blocks of memory consequently becomes quite small. This problem, coupled with incomplete usage of the allocated memory, results in memory fragmentation.

For example, consider a system having 5 MB total memory. Let the total free memory be 2 MB which the programs could use at runtime. However, due to interspersed free and used memory blocks the user is not able to allocate even 1 MB of free space for a new program as all the free memory blocks are not larger than 500 KB. Also, if in the 3 MB allocated memory only 2 MB is used then the remaining 1 MB memory goes unused. This wastage of space is the major problem of internal and external memory fragmentation.

Types of memory fragmentation

ADVANCED SYSTEM SOFTWARE CONTENT BEYOND SYLLABUS – I "Fragmented memory" denotes all of the system's unusablemalloc) . Generally, memory allocation performed during runtime is not in the form of stacks. The memory allocator wastes memory in the following ways:  1. Overhead  2. Internal Fragmentation  3. External Fragmentation. When blocks of memory are allocated during runtime, it is highly unlikely that these released blocks of memory will again form continuous large memory blocks. Hence, the free memory gets interspersed with the blocks of memory in use. The average size of blocks of memory consequently becomes quite small. This problem, coupled with incomplete usage of the allocated memory, results in memory fragmentation. For example, consider a system having 5 MB total memory. Let the total free memory be 2 MB which the programs could use at runtime. However, due to interspersed free and used memory blocks the user is not able to allocate even 1 MB of free space for a new program as all the free memory blocks are not larger than 500 KB. Also, if in the 3 MB allocated memory only 2 MB is used then the remaining 1 MB memory goes unused. This wastage of space is the major problem of internal and external memory fragmentation. Types of memory fragmentation " id="pdf-obj-0-36" src="pdf-obj-0-36.jpg">

Overhead

The memory allocator needs to store all the information related to all memory allocations. This information includes the location, size and ownership of any free blocks, as well as other internal status details. Overhead comprises all the additional system resources that the programming algorithm requires. A dynamic memory allocator typically stores this overhead information in the memory it manages. This leads to wastage of memory. Hence, it is considered as a part of memory fragmentation.

Internal fragmentation

When the memory allocated is larger than required, the rest is wasted. Some reasons for excess allocation are:

1. Allocator policy - involves architectural constraints,

2. A client asks for more memory than is required.

The term "internal" refers to the fact that the unusable storage is inside the allocated region. while this may seem foolish, it is often accepted in return for increased efficiency or simplicity. There are some basic memory allocation rules which all memory allocators must adhere to. According to the "segregated free list" allocator policy, all memory allocations must start at an address divisible by 4, 8, or 16. The memory allocator may assign blocks of only certain predefined sizes to clients. It depends upon the processor architecture. Also, extra bytes are assigned to a program for alignment and metadata.

Or in many file systems, each file always starts at the beginning of a cluster because this simplifies organization and makes it easier to grow files. Any space left over between the last byte of the file and the first byte of the next cluster is a form of internal fragmentation called file slack, slack space, or cluster overhang. Slack space is a very important source of evidence in computer forensic investigation. Unlike other types of fragmentation, internal fragmentation is difficult to reclaim; usually the best way to remove it is with a design change. For example, in dynamic memory allocation, memory pools drastically cut internal fragmentation by spreading the space overhead over a larger number of objects.

External fragmentation

External fragmentation is the inability to use free memory as the free memory is divided into small blocks of memory and these blocks are interspersed with the allocated memory. 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. The result is that although free storage is available, it is effectively unusable because it is divided into pieces that are too small to satisfy the demands of the application. The term "external" refers to the fact that the unusable storage is outside the allocated regions.

ADVANCED SYSTEM SOFTWARE

CONTENT BEYOND SYLLABUS - II

The MASM32 SDK version 11 is a working development environment for programmers who are interested in either learning or writing 32 bit Microsoft assembler (MASM). The installation is an automated process that installs the correct directory tree structure on the local drive of your choice.

Note that MASM32 will not install on a network drive. MASM32 comes with its own runtime library written fully in assembler and an extensive range of macros for improved high level emulation and faster development. It builds its own IMPORT libraries for the Windows API functions and supplies its own include files for a very large number of API functions.

The default editor in MASM32 has been fully recoded from scratch in MASM and it is smaller, faster and more powerful with two (2) separate scripting engines, a legacy version to maintain backwards compatibility of existing scripts and a completely new one that is much faster and more powerful than its predecessor.

New CHM documentation and a wider range of "Create New" project types directly supported by the new script engine from the editor place a wider range of project types at your fingertips. There is also a new format PLUGIN system for the default editor as well as the old one for backwards compatibility. UNICODE Support The MASM32 SDK has a completely new include file system that supports either ASCII

or UNICODE by the inclusion of an equate, __

UNICODE __

. Two new macro systems support

UNICODE text that can be used in much the same manner as embedded ASCII text.

DEP Compatibility The MASM32 SDK has been rebuilt to ensure it is fully compatible with the Data Execution Prevention safety feature in later versions of Windows. OS Version The MASM32 SDK requires Win2000 or higher Windows versions. The Installation is not designed to run on Win9x or ME.

Features

1.

The most up to date version of Ray Filiatreault's floating point library and tutorial.

2.

A completely new dedicated time and date library written by Greg Lyon.

3.

The MASM32 library with over 200 procedures for writing general purpose high performance

code.

4.

A new dynamic array system for variable length string and binary data with both a macro and

procedural interface.

5.

The include files and libraries have been upgraded to include VISTA / Win7 with additional

equates and structures.

6.

A specialised linker, resource compiler and assembler from Pelle's tool set with working

examples.

7.

An extensive range of example code ranging from simple examples to more complex code

design.

8.

Prebuilt scripts in the editor for creating working templates for assembler projects.

9.

A very easy to use console interface for developing algorithms, test code and experimental

ideas in code. Application MASM is routinely capable of building complete executable files, dynamic link libraries and separate object modules and libraries to use with the Microsoft Visual C development environment as well as MASM. It is an esoteric tool that is not for the faint of heart and it is reasonably complex to master but in skilled hands it has performance that is beyond the best of modern compilers when properly written which makes it useful for performance critical tasks.

ADVANCED SYSTEM SOFTWARE

CONTENT BEYOND SYLLABUS - III

A computer's central processor can only execute program code found in read-only memory (ROM), random access memory (RAM), or (for computers of the 1950s through 1970s) switches on an operator's front panel. Modern operating systems, application code, and data are stored on nonvolatile data storage devices, such as hard drives, CDs, DVDs, flash memory cards (like SD cards), USB flash drives, and floppy disks. When a computer is first powered on, it usually does not have an operating system in ROM or RAM. The computer must execute a relatively small program stored in ROM, along with the bare minimum of data needed to access the nonvolatile devices from which the operating system programs and data may be loaded into RAM.

The small program that starts this sequence is known as a bootstrap loader, bootstrap or boot loader. This small program's only job is to load other data and programs which are then executed from RAM. Often, multiple-stage boot loaders are used, during which several programs of increasing complexity load one after the other in a process of chain loading.PDP-8/E front panel showing the switches used to load the bootstrap.

Early computers (such as the IBM 650, DEC PDP-5 through PDP-8, early models of the PDP-11, and early microcomputers such as the Altair 8800) had a row of dials or toggle switches on the front panel that allowed the operator to manually enter the boot instructions into memory before transferring control to the CPU. They could also be used to pass instructions directly to the CPU. Interestingly, the PDP-1 had a hardware built-in loader, such that an operator only needed to push the "load" switch and the paper tape reader would read a program directly into core memory. The boot loader would then read in either the second-stage boot loader (called Binary Loader of paper tape with checksum) or the operating system from an outside storage medium such as paper tape, punched card, or a disk drive.

Pseudocode for the bootloader might be as simple as the following eight instructions:

  • 1. Set the P register to 9

3.

If not ready, jump to 2

  • 4. Read a byte from paper tape reader to accumulator

  • 5. If end of tape, jump to 9

  • 6. Store accumulator to address in P register

  • 7. Increment the P register

  • 8. Jump to 2

Some computer systems, upon receiving a boot signal from a human operator or a peripheral device, may load a very small number of fixed instructions into memory at a specific location, initialize at least one CPU, and then point the CPU to the instructions and start their execution. These instructions typically start an input operation from some peripheral device (which may be switch-selectable by the operator).

Other systems may send hardware commands directly to peripheral devices or I/O controllers that cause an extremely simple input operation (such as "read sector zero of the system device into memory starting at location 1000") to be carried out, effectively loading a small number of bootload instructions into memory; a completion signal from the I/O device may then be used to start execution of the instructions by the CPU.

Smaller computers often use less flexible but more automatic bootload mechanisms to ensure that the computer starts quickly and with a predetermined software configuration. In many desktop computers, for example, the bootstrapping process begins with the CPU executing software contained in ROM (for example, the BIOS of an IBM PC) at a predefined address (some CPUs, including the Intel x86 series are designed to execute this software after reset without outside help). This software contains rudimentary functionality to search for devices eligible to participate in booting, and load a small program from a special section (most commonly the boot sector) of the most promising device.

In the ANSI C language, definitions and invocation of macros are handled by a preprocessor. This preprocessor is not integrated with the compiler.

ANSI C Macro definitions:

Macros are used to define symbolic names.

Example:

# define PI 3.14 # define NULL 0.

wherever PI and NULL occurs in the program, they are replaced by 3.14 and 0 respectively. The macro

# define EQ = = can be used to reduce the common errors which always occurs while writing programs in C. The programmer is allowed to write Statement like while (I EQ O) { . . .

} and the macro processor would convert this to while ( I = = 0) { . . }

Use of Macros instead of functions:

Macro is more efficient than functions as the amount of computation required Is less than the overhead of calling a function. Example:

# define ABSDIFF (X,Y) ((X) > (Y) ? (X) (Y) : (Y) (X)) and the macro invocation statement ABSDIFF (I+1, J-5) would result in macro expansion statement ((I+1) > (J 5) ? (I+1) (J 5) : (J 5) (I + 1)) In this macro definition, the macro processor simply makes string substitutions, without considering the syntax of the C language.

As a result, the macro Invocation statement ABSDIFF (4 + 1, 8 6) would result in

4 + 1 > 8 6 ? 4 + 18 6 : 8 6 4 + 1 which gives a unexpected result.

Nested Macro Invocations:

Nested macro invocation statement like DISPLAY (ABSDIFF (3,8)) would be expanded to Printf (“ABSDIFF (3,8)” “=%d \n”, ABSDIFF (3,8)) After rescanning, would be printf (“ABSDIFF (3,8)” “=%d\n”, ((3) > (8) ? (3) (8) : (8) (3)) when executed, the display would be ABSDIFF (3,8) = 5.

Macro Conditional Statements:

# ifndef BUFFERSIZE # define BUFFERSIZE 1024 # endif.

which means if buffersize is not defined, buffersize is defined to 1024. Similar macro conditional statements can be used to check for errors like subscript errors and so on.

System software is computer software designed to operate the computer hardware and to provide a platform for running application software. The most basic types of system software are:

Device drivers such as computer BIOS and device firmware; these provides basic functionality to operate and control the hardware connected to or built into the computer. The operating system (prominent examples being Microsoft Windows, Mac OS X and Linux), which allows the parts of a computer to work together by performing tasks like transferring data between memory and disks or rendering output onto a display device. It also provides a platform to run high-level system software and application software. Servers, in this context, are computer programs running to serve the requests of other programs, the "clients". The server performs some computational task on behalf of clients which may run on either the same computer or on other computers connected through a network. Utility software, which helps to analyze, configure, optimize and maintain the computer. Window systems are components of a graphical user interface (GUI), and more specifically of a desktop environment, which supports the implementation of window managers, and provides basic support for graphics hardware, pointing devices such as mice, and keyboards. The mouse cursor is also generally drawn by the windowing system. In some publications, the term system software is also used to designate software development tools (like a compiler, linker or debugger).