Title: Evolution of Memory Management in MAC OS
1Evolution of Memory Management in MAC OS
2Memory Management
- Memory management hardware (MMUs, RAM, etc.)
- Operating system memory management (virtual
memory, protection) - Application memory management (allocation,
deallocation, garbage collection)
3Memory Management Hardware
- Memory Management Units
- Random Access Memory
4Operating System Memory Management
- Virtual Memory
- It is an addressing scheme implemented in
hardware and software that allows non-contiguous
memory to be addressed as if it is contiguous - Protection
- Many operating systems support protection of
memory pages. Individual pages may be protected
against a combination of read, write or execute
accesses by a process -
5Application Memory Management
- Allocation
- Allocation is the process of assigning resources
- Deallocation
- In manual memory management, to free or
deallocate an object is to tell the memory
manager that it is no longer needed - Garbage Collection
- Garbage collection (GC), also known as automatic
memory management, is the automatic recycling of
dynamically allocated memory
6Organization of Memory in Mac OS
- System partition
- System Heap
- System Global Variables
- Application partition
- Application Stack
- Application Heap
- Application Global Variables and A5 world
7Organization of Memory in Mac OS Contd..
- Temporary memory
- Virtual memory
- In system software version 7.0 and later
Macintosh computers take advantage of the OS
feature known as virtual memory, by which the
machine have a logical address space that extends
beyond the limits of the available physical
memory - Addressing modes
- Latest operating system supports 32 bit
addressing - Earlier versions supported 24 bit addressing
8LISA OS (Office System)
- Introduced in January 1983
- Motorola 68000 CPU at a 5 MHz clock rate and had
1 Mibytes RAM - The Lisa operating system featured cooperative
(non-preemptive) multitasking and virtual memory - Virtual memory coupled with a fairly slow disk
system made the system performance seem sluggish
at times - The Lisa supported a sophisticated hardware based
memory management strategy - This strategy allowed Lisa programs to believe
they could access more memory than there really
was in the Lisa
9Memory Management Unit - Lisa
- 24 bit logical address with 16 Mbytes of logical
address space and this space is divided into 128
segments - Each segment consists of up to 128 Kbytes in
blocks of 512 bytes - Upper 7 bits of the 24 bits is segment number and
the remaining 17 bits are offset within that
segment - To access actual locations in the Lisa hardware,
logical addresses are translated into physical
addresses by a section of logic on the processor
board known as the Memory Management Unit (MMU) - The MMU hardware permits the operating system to
control the entire relocation process. MMU
prevents a particular process from accessing
areas of memory outside of the portion assigned
to it
10MMU Lisa Contd..
- The Lisas RAM memory occupies 2 Mbytes of
physical address space. This would imply that
only 16 segments, each of size 128 Kbytes, could
be used - Each segment does not necessarily occupy the full
128 Kbytes allotted to it in logical address
space. Each segment can be mapped into as little
as one 512-byte block and 16 logical segments can
map into 2-Mbyte physical memory - Areas larger than 128 Kbytes can be accommodated
by treating multiple logically contiguous
segments as one segment - The translation of a logical address to a
physical address by the MMU is performed on a
segment-by-segment basis - Associated with each segment in the MMU is its
origin which is the 12-bit block number in the
physical address space where the corresponding
segment begins
11MMU Lisa Contd..
- The logical block number from bits 9-16 of the
logical address is added to the segments origin
value to produce the physical block number to be
accessed - The nine displacement bits from the logical
address translate directly into the physical
displacement - The MMU also performs access checks to verify
that the requested access is allowed. The MMU
checks each access to ensure that it does not
exceed the bounds of the specified segment - In addition, an attempt to access a segment which
is not mapped or an attempt to write into a
read-only segment will generate an access
violation - These access violations trap to the operating
system for handling
12System 6
13MultiFinder
- It provided each application CPU time, and a way
for windows from different applications to
co-exist - When an application was activated, all of its
windows were brought forward as a single layer - It also provided a way for applications to
supply their memory requirements ahead of time,
so that MultiFinder could allocate a chunk of RAM
to each according to need
14Connectix
- Connectix Corporation was a software and hardware
company, noted for having released innovative
products that were either made obsolete as Apple
Computer incorporated the ideas into system
software, or were sold to other companies once
they become popular - MODE32 software, which allowed 32-bit addressing
on "32-bit-dirty" Machintosh systems (later
bought by Apple and distributed for free, at
least in part to settle a class-action lawsuit
brought by customers who demanded to know why
their 32-bit 68020 microprocessors could not
access more than 8 megabytes of RAM)
15System 7
First to use MMU. VM features such as protected
address space, memory mapped files, page locking,
shared memory, etc. were not present
16Multitasking
- Multitasking is a method by which multiple tasks,
also known as processes, share common processing
resources such as a CPU - In the case of a computer with a single CPU, only
one task is said to be running at any point in
time, meaning that the CPU is actively executing
instructions for that task - Multitasking solves the problem by scheduling
which task may be the one running at any given
time, and when another waiting task gets a turn
17Multitasking Contd..
Operating systems may adopt one of many different
scheduling strategies, which generally fall into
the following categories
Mac OS used cooperative multitasking to enable
the running of multiple applications
simultaneously.
18Scheduling Categories
- In multiprogramming systems, the running task
keeps running until it performs an operation that
requires waiting for an external event (e.g.
reading from a tape) or until the computer's
scheduler forcibly swaps the running task out of
the CPU. Multiprogramming systems are designed to
maximize CPU usage - In Cooperative Multitasking / time-sharing
systems, the running task is required to
relinquish the CPU, either voluntarily or by an
external event such as a hardware interrupt. Time
sharing systems are designed to allow several
programs to execute apparently simultaneously - In real-time systems, some waiting tasks are
guaranteed to be given the CPU when an external
event occurs. Real time systems are designed to
control mechanical devices such as industrial
robots, which require timely processing
19Finder and MultiFinder
- The Finder is the default application program
used on the MAC OS and MAC OSX operating systems
that is responsible for the overall
user-management of files, disks, network volumes
and the launching of other applications - As such the Finder acts like the shell on other
operating systems, but using a graphical user
interface - The Finder is the first program a user interacts
with after booting a Mac (and potentially logging
in), and as such it is responsible for the
general look and feel of the machine - Finder on System 1.0 4.1 could only run one
application at a time, through special
application shells such as Switcher - Early versions of the Finder would shut down
whenever another program was launched, due to the
single-tasking nature of the original Mac OS
20Finder and MultiFinder Contd..
- System 5 added MultiFinder, an add-on replacement
for the Finder which could run several programs
at once. Time was given to the background
applications only when the foreground (or
"running") applications gave it up (cooperative
multitasking) - System 5 and 6 came with option of selecting
Finder or MultiFinder. If MultiFinder were
selected, the Finder and its functions continued
to run when an application was launched. The
MultiFinder environment allowed users to see past
the windows of running applications to view
Finder icons such as the Trash, or the windows of
other applications running in the background - This was at the expense of more RAM, so it was
not always possible to multitask if one of the
applications required too large a portion of the
available RAM - In System 7.0, the MultiFinder replaced the
original Finder, and Apple renamed it to Finder
21MAC OS 9
- MAC OS 9 and earlier allocated static blocks of
memory to applications whether or not
applications needed it - Example if you are working on a 100 MB poster
in Photoshop, the application still stakes claim
of available RAM - This increases the use of virtual memory, which
in turn slows memory performance - Prior to MAC OS X used Time Slice architecture,
where every application is allotted time to the
processor
22Time Slice Architecture
- Every application is allotted time to the
processor. Applications in this environment are
required to cooperatively share processor time - Furthermore, the memory is unprotected. That is,
an application could write into critical memory
space that may be in use by the operating system
kernel - The result is the infamous bomb alert on the
desktop with the button highlighted for restart - Mac OS X brings to the table a preemptive
multitasking system - This means the kernel schedules time to each
(process) application and governs how much time
it is allotted. - The kernel will also assign address space to the
application - The application will not be allowed to write
outside of this without the kernel taking action.
This protected memory environment will change
everything for Mac users
23MAC OS X
- Unix style memory management and pre-emptive
multitasking - This new memory management system allowed more
programs to run at once and virtually eliminated
the possibility of one program crashing another - Virtual memory has been incorporated in the
underpinnings of the OS, and the OS dynamically
allocates RAM to applications as they need it
24References
- http//en.wikipedia.org/wiki/MultiFinder
- http//en.wikipedia.org/wiki/Lisa_OS
- http//en.wikipedia.org/wiki/System_6
- http//en.wikipedia.org/wiki/System_7_(Macintosh)
- http//developer.apple.com/documentation/
- http//developer.apple.com/documentation/mac/pdf/M
emory/pdf.html - http//www.memorymanagement.org/glossary/m.htmlme
mory.management - http//developer.apple.com/technotes/tn/tn1176.htm
l - http//members.safe-t.net/jwalker/programming/lisa
Legacy/ - http//kb.iu.edu/data/agww.html
- http//patimg1.uspto.gov
- http//ieeexplore.ieee.org/xpl/freeabs_all.jsp?tp
arnumber1457132isnumber31335