Evil Washing Machine
Evil Washing Machine

Reputation: 1341

Is there an explanation on the paging qn asked in 'The Social Network'?

"Suppose you are given a computer with a 16-bit virtual address and a page size of 256 bytes. The system uses 1-level page tables that start at address hex 400. Maybe you want DMA...who knows? The first few pages are reserved for hardware flags, etc. Assume page table entries have 8 status bits. The 8 status bits would be..."

http://www.youtube.com/watch?v=-3Rt2_9d7Jg

Can someone explain why the answer is as Mark/Jesse described?

Upvotes: 13

Views: 21291

Answers (2)

yashwanth yerra
yashwanth yerra

Reputation: 1

Virtual page address translation into physical address using page table

Page table entry

Let me explain what I understand about page size and virtual addressing. So here's what I know: when the page size is 256 bytes, we have a 16-bit virtual address system where:

  • 8 bits are used for the page number (can reference 2^8 = 256 different pages)
  • 8 bits are used for the offset (because 2^8 = 256 bytes per page)

What are these 8 hardware flag bits(also called as status bits)?

These hardware bits are part of page table entries where it contains information of frame number and 8 hardware flag bits(also called status bits).

From what I learned, these 8 bits are split into status bits and permission bits which are specified in page table entry for each page: First 3 Status Bits

Present/Absent(Valid) bit
Dirty(Modified) bit
Reference bit

I'm still learning about exactly how these work and will update once I understand them better. Protection(Permission) Bits (5 bits) Let's say we have permission bits like 00400. Here's what that means: The first two digits (00) are for special permission flags:

0 = nothing special
4 = setuid (lets you run file with owner's permissions)
2 = setgid (lets you run file with group's permissions)
1 = sticky bit (only file owner can delete it)

The last three digits (400) control regular file permissions:

First digit = what the user can do
Second digit = what the group can do
Third digit = what others can do

The numbers mean:

4 = read (r)
2 = write (w)
1 = execute (x)
0 = no permissions

you can combine them :

5 = read and execute (4 + 1)
6 = read and write (4 + 2)
7 = read, write, and execute (4 + 2 + 1)

I still need to research more about those first three bits (valid, modified, and reference). I'll update this once I have a better understanding of how they work.

Upvotes: 0

tangrs
tangrs

Reputation: 9930

According to this page documenting some technical inaccuracies of The Social Network, the question is a (badly) derived from a question from an actual Harvard course.

A sample problem: Suppose we are given a computer with a 16-bit virtual addresses, and a page size of 256 bytes. The system uses one-level page tables, which start at address 0x0400. (The first few pages are reserved for hardware flags, etc. Maybe you wanted to have DMA on your 16-bit system, who knows?) Assume page table entries have eight status bits: 1 valid bit, 1 modify bit, 1 reference bit, and 5 permissions bits (this is a very secure system).

How many pages are there? How much memory do the page tables require?

The 8 status bits are architecture dependent and, in this particular problem, is made up as an assumption for an imaginary computer. The movie producers simply took the problem description and made one of the assumptions the question - a question that doesn't make sense to ask in the first place.

To more easily understand this, imagine that you have a question like the following

A car traveled across a road for 1 hour. Assuming the car's speed is 100km/h, how much distance did the car travel?

and the question turned into

A car traveled across a road for 1 hour. The speed of the car was...?

Edit: Didn't realise the original article used a similar analogy to mine.

Upvotes: 33

Related Questions