You are on page 1of 5

KIGALI INSTITUTE OF SCIENCE AND TECHNOLOGY (KIST)

DATE: Saturday, April 11, 2009

Subject: OPERATING SYSTEM

ASSIGNMENT:

1. Discuss Memory Protection and sharing


2. What is DLL (Dynamic Link Library), How is it Useful?

By MBANZABUGABO Jean Baptiste


Computer Engineering and Information Technology(CEIT)
YEAR 3

2
I. MEMORY PROTECTION AND SHARING

Introduction

The Memory management in the operating system should therefore be able


to relocate programs in memory and handle memory references in the code
of the program so that they always point to the right location in memory.
Memory protection and sharing are ones in the principal goals of the
operating system's memory management.

Therefore, Processes should not be able to reference the memory for


another process without permission. This is called memory protection, and
prevents malicious or malfunctioning code in one program from interfering
with the operation of other running programs.

Even though the memory for different processes is protected from each
other, different processes should be able to share information and therefore
access the same part of memory. This is called memory sharing.

 Why to protect memory?


 To protect the OS from user processes
 And to protect user process from each other.
 How to protect memory?
 To use relocation registers and limit registers to protect user
processes from each other, and from changing operating-system
code and data.
 The relocation register contains the value of smallest physical
address; the limit register contains the range of logical
addresses – each logical address must be less than the limit
register.

In furthermore, Memory protection is a way for controlling memory usage on


a computer, and is core to virtually every OS. The main purpose of memory
protection is to prevent processes on an operating system from accessing
the memory of other processes. This prevents bug in one process affecting
another process, and also prevents malicious software from gaining
unauthorized access to the system.
Memory protection usually relies on a combination of hardware (a memory
management unit) and software to allocate memory to processes and
handle exceptions.
The effectiveness of memory protection varies from one operating system to
another.

There are different ways to achieve memory protection. These include:

 Segmentation
Segmentation refers to dividing a computer's memory into segments.
The term segmentation can be seen as an extension, where every process is
divided between several partitions. These partitions are called segments. We
could, for example, separate a program into a code, a data and a stack
segment. For dynamic systems, this is useful for relocation issues as well as
for reducing the size of partitions, making for better memory utilization.

 Paging
In paging, the memory address space is divided into equal, small pieces,
called pages. Using a virtual memory mechanism, each page can be made to
reside in any location of the physical memory, or be flagged as being
protected. Virtual memory makes it possible to have a linear virtual memory
address space and to use it to access blocks fragmented over physical
memory address space.

In computing, sharing memory is a memory that may be


simultaneously accessed by multiple programs with an intent to provide
communication among them or avoid redundant copies. Depending on
context, programs may run on a single processor or on multiple separate
processors. Using memory for communication inside a single program, for
example among its multiple threads, is generally not referred to as shared
memory.

In hardware

In computer hardware, sharing memory refers to a large block of random


access memory that can be accessed by several different central processing
units in a multiple-processor computer system.

A shared memory system is relatively easy to program since all processors


share a single view of data and the communication between processors can
be as fast as memory accesses to a same location.
In software

In computer software, sharing memory is either

A method of inter-process communication (IPC), as. a way of exchanging


data between programs running at the same time. One process will create
an area in RAM which other processes can access, or

a method of conserving memory space by directing accesses to what would


ordinarily be copies of a piece of data to a single instance instead, by using
virtual memory mappings or with explicit support of the program in
question.

II. DYNAMIC LINK LIBRARY

A dynamic link library (DLL) is a collection of small programs,


any of which can be called when needed by a larger program that is running
in the computer. The small program that lets the larger program
communicate with a specific device such as a printer or scanner is often
packaged as a DLL program (usually referred to as a DLL file). DLL files that
support specific device operation are known as device drivers.

The advantage of DLL files is that, because they don't get loaded into
random access memory (RAM) together with the main program, space is
saved in RAM. When and if a DLL file is needed, then it is loaded and run.
For example, as long as a user of Microsoft Word is editing a document, the
printer DLL file does not need to be loaded into RAM. If the user decides to
print the document, then the Word application causes the printer DLL file to
be loaded and run.

A DLL file is often given a ".dll" file name suffix. DLL files are dynamically
linked with the program that uses them during program execution rather
than being compiled with the main program. The set of such files (or the
DLL) is somewhat comparable to the library routines provided with
programming languages such as C and C++.

References:

1. Michael M. Swift , Brian N. Bershad , Henry M. Levy, Improving the reliability of


commodity operating systems, ACM Transactions on Computer Systems (TOCS), v.23
n.1, p.77-110, February 2005.
2. WWW. ybet.be
3. www.google.com

You might also like