You are on page 1of 16

Overview:

OS?
It is an interface between the hardware and the user
Multiuser Operating system?
Ex: Unix server where multiple remote users have
access to the Unix shell prompt at the same time
80286 is the first 8086 family processor designed to
make these implementations easier
Virtual memory is a feature of OS
80286 can operate in 2 modes
Real modeAlmost as 8086
Protected mode
Next Slide
80286 architecture:
80286 Architecture:
BU performs all memory and IO read and writes
BU Prefetches instruction bytes
BU is responsible for data transfer
IU decodes instruction
IU holds them in a queue
EU can access the prefetched instructions
EU16 bit ALU
EU executes instructions from IU
80286register set in real mode is the same as that of
8086 in addition to MSW (Machine Status Word)
Address Unit computes physical addresses that will be sent
out to memory or IO
In real mode, How physical address is computed?

Just like they are computed in 8086

80286 in real mode addresses upto 1MB of physical memory

In Protected mode, How?

In detail we will see, All the 24 address lines are used

80286 in protected mode addresses upto 16MB of physical


memory
Data bus16 bit

Address busNon multiplexed24 bit (16MB of physical


memory are addressable in protected mode)
Already seen in Pin diagram of 8086
A0 and BHE are used to determine whether or not byte
transfer is to made on upper data lines
The same is the case with 80286
80286 functions like 8086 in maximum mode
HOLD, HLDA, INTR, INTA, NMI, READY, LOCK,
RESET pins of 80286 function exactly the same as they
function in 8086
80287 math coprocessor
If it wants 80286 to perform a data transfer then
PEREQ (Processor Extension Request) is asserted to tell
80286 about data transfer
80286 asserts PEACK to let 80287 know that data transfer
has started
If during a data transfer, if logic 0 arrives on BUSY then
80286 may be interrupted
This is to let 80286 the operating condition of 80287
If during a data transfer if logic 0 arrives on ERROR then
80286 do a type 16H interrupt call
This is to let 80286 that some error has occurred
80286 Real mode:
When 80286 is reset, it starts executing in real mode
How physical addresses are calculated?
1MB of physical memory
Due to extensive pipelining 80286 executes programs several
times faster than 8086
In the first 1KB IVT will be there
Interrupt: Asynchronous external events that affect
processor through NMI or INTR
Exception: Software interrupts produced by INT n
instructions are called exceptions
Exceptions are of 2 kinds
Fault: Exceptions that are detected and signaled before
the faulting instruction is executed
Segment-not-present
Trap: Exceptions that reported after the instruction that
caused the exception executes
Divide by zero
80286 Protected mode:
First choosing a multiuser OS is important
Lets say 80286 us running a multi user OS
When turned on it will be in real mode
This real mode of 80286 will be used to initialize peripheral
devices, load OS, load registers, load descriptor tables
After this 80286 is switched to protected mode
How?
By setting the Protection Enable bit in MSW
Bit 1 is used to indicate the presence or absence of
coprocessor
Final step to be done is intersegment jump to the start of the
main system program that flushes the byte queue and set
everything right for protected mode
80286 MSW and flags:
MSW: 16 bits
Bit 0--- PE--- to make 80286 switch from real to protected
Bit 1--- MP---Monitor Processor Extension
Bit 2--- EM---Emulate Processor Extension
Bit 3--- TS---Task Switch
Flags:
Virtual Memory:
Virtual memory is the memory that appears to exist as main
storage through the support given by secondary storage
Virtual memory is a feature of OS but most of the times
requires a hardware device called MMU (Memory
Management Unit)
In protected mode address unit functions as MMU
Virtual Memory system:
In this system, segments currently used for program execution
are loaded into memory from disk
If this program needs a segment and that it is not there in
RAM (RAM is full) then one of the segments is swapped out
and the desired segment is swapped in
How? later
Disadvantage of swapping segments is time required to
swap in a large segment will slow down execution
There is another scheme where will swap fixed length
pages (4KB) in and out of memory
Disadvantage of this scheme is that they dont
correspond to logical structure of program
Virtual memory appears to be there but it is not there
If you write a program for a virtual memory system, you
can write thinking that you have more memory space in
your hand though there is less of physical memory
Virtual memory concept is based on the fact that not all
the segments are going to be present in physical memory
at a point of time
Physical address calculation in protected mode:
Protected Mode?
An executing program asks for a segment
Logical address is generated by CPU
This logical address goes to MMU
Each logical address is represented with a 16 bit selector and
16 bit offset
In real mode the first 16 bit represents the upper 16 bits of
real memory address
Here the selector specifies an index into memory resident
table called descriptor table
A descriptor contains the 24 bit physical base address for the
segment
Now this physical address is added with offset to produce the
required 24 bit physical address that is sent out of address
lines
The segment is put on data bus
Then taken over to prefetch queue by BU, taken over to
decode queue by IU and finally for execution
Scenario: An executing program asks for a segment and
sometimes we can be said that access denied?
Suppose an executing program asks for a segment that is OS
sensitive then such thing must be said
For that, a descriptor has protection and control bits
Selector has 2 bits for privilege levels
MMU compares the bits of selector with that of descriptor
If the selector privilege level is low then MMU refuses access
Calculation of Virtual memory:
14 bits of the selector can be used for selecting segments
2^14=16384 segments are addressable
Offset16 bits, 2^16=65536 bytes=64KB
Each segment is a 64KB segment
Virtual memory= 16384*64 KB
1048576 KB
1GB
We can work as though we have 1GB of physical memory
Actual physical memory 16MB (2^24=16777216 bytes)
Scenario 2: If the program asks for a segment and if the
segment is not available in memory
One of the segments is swapped out and the required segment
is swapped in
How?
Swap in: MMU sends an interrupt to CPU
OS executes an ISR and the desired code is loaded into
physical memory
Swap out: If RAM is full, then which segment will be
swapped out
To decide which segment has to be swapped out, for each
segment descriptor maintains accessed bit
This bit is sometimes called dirty bit
Replacement algorithms
MMU together with descriptor table makes virtual memory
possible
How MMU checks for the presence of segment?
There is a P bit in the descriptor with which MMU will come
to know whether segment is present or not
If you want 80286 operating in protected mode to get back to
real mode the only way is by resetting the system
(disadvantage)
Suppose I want to run a 8086 program during a time slice then
I cant do so easily (only go is resetting the system)

You might also like