6.828:Opertate System Engineering Fall 2018

Hits: 0

Course link: https://pdos.csail.mit.edu/6.828/2018/schedule.html

The latest version of the course link: https://pdos.csail.mit.edu/6.828

Course repository: https://pdos.csail.mit.edu/6.828/2018/jos.git

Reference: https://pdos.csail.mit.edu/6.828/2018/reference.html

To be continued~~~

Article directory

Lecture

Lecture1 Operating Systems

The purpose of an O/S

  • Support applications
  • Abstract the hardware for convenience and portability
  • Multiplex the hardware among multiple applications
  • Isolate applications in order to contain bugs
  • Allow sharing among applications
  • Provide high performance

Lecture2 PC hardware and x86 programming

EIP

  1. EIP is incremented after each instruction
  2. Instructions are different length
  3. EIP modified by CALL, RET, JMP, and conditional JMP

Registers

Eight 32-bit general-purpose registers: %eax, %ebx, %ecx, %edx, %edi, %esi, %ebp, %esp
(32-bit can be divided into 16-bit such as %ax, %bx, 16- bit can be divided into 8bit such as %al and %ah)

1 32-bit program counter: %eip

1 80-bit floating point register

Control registers: %cr0, %cr2, %cr3, %cr4

Debug registers: %dr0, %dr1, %dr2, %dr3

Segment registers: %cs, %ds, %es, %fs, %gs, %ss

Global and local descriptor table pseudo-registers: %gdtr, %ldtr

Memory

movl %eax, %edx             edx = eax                                     register mode
movl $0x123, %edx           edx = 0x123                                   immediate
movl 0x123, %edx            edx = *(int32_t*)0x123                        direct
movl (%ebx), %edx           edx = *(int32_t*)ebx                          indirect
movl 4(%ebx), %edx          edx = *(int32_t*)(ebx+4)                      displaced

Stack memory

pushl %eax = subl $4, %esp & movl %eax, (%esp)
popl %eax = movl (%esp), %eax & addl $4, %esp
call 0x12345 = pushl %eip(*) & movl $0x12345, %eip(*)
right = popl %eip(*)

I/0 space and instructions

inb/outb

Memory-mapped I/O

GCC calling conventions

int main(void) {return f(8)+1; }
int f(int x) {return g(x); }
int g(int x) {return x+3; }

_main:
    (prologue)
    pushl %ebp
    movl %esp, %ebp
    (body)
    pushl $8
    call _f
    addl $1, %eax
    (epilogue)
    movl %ebp, %esp
    popl %ebp
    ret
_f:
    (prologue)
    pushl %ebp
    movl %esp, %ebp
    (body)
    pushl 8(%esp)
    call _g
    (epilogue)
    movl %ebp, %esp
    popl %ebp
    ret
_g:
    (prologue)
    pushl %ebp
    movl %esp, %ebp
    (save %ebx)
    pushl %ebx
    (body)
    movl 8(%ebp), %ebx
    addl $3, %ebx
    movl %ebx, %eax
    (restore %ebx)
    popl %ebx
    (epilogue)
    movl %ebp, %esp
    popl %ebp
    ret

Lecture3 C and gdb

Lecture4 Shell & OS organization

xv6 follows a traditional design: all of the OS runs in kernel mode
microkernel design
exokernel

Lecture5 Isolation mechanisms

Lecture6 Virtual Memory (1)

Lecture7 Virtual Memory (2)

UVPT/UVPD

Lecture8 Interrupts, System calls, and Exceptions

Lecture9 Multiprocessors and locking

Lecture10 Processes, threads, and scheduling

xv6 solution:

1 user thread and 1 kernel thread per process
1 scheduler thread per processor
xv6 has lots of kernel threads sharing the single kernel address space
xv6 has only one user thread per process

Overview of xv6 processing switching:

  1. user -> kernel thread (via system call or timer)
  2. kernel thread yields, due to pre-emption or waiting for I/O
  3. kernel thread -> scheduler thread
  4. scheduler thread finds a RUNNABLE kernel thread
  5. scheduler thread -> kernel thread
  6. kernel thread -> user

Lab

6.828: Lab1 Booting a PC Experiment Summary
6.828: Lab2 Memory Management Experiment Summary
6.828: Lab3 User Environments Experiment Summary
6.828: Lab4 Preemptive Multitasking Experiment Summary
6.828: Lab5 File system, Spawn and Shell Experiment Summary
6.828: Lab6 Network Driver Experiment Summary

Homework

6.828: Homework Summary

You may also like...

Leave a Reply

Your email address will not be published.