Kennem's Blog
  • 🏠主页
  • 🔍搜索
  • 📚文章
  • ⏱时间轴
  • 🔖标签
  • 🗂️分类
  • 🙋🏻‍♂️关于
主页 » 🗂️ 分类

操作系统

MIT6.S081(13)-Coordination (sleep&wakeup)

MIT6.S081(13)-Coordination (sleep&wakeup) plan Re-emphasize a few points about xv6 thread switching sequence coordination sleep & wakeup lost wakeup problem termination Why hold p->lock across swtch()? this is an important point and affects many situations in xv6 [diagram: P1, STACK1, swtch, STACK_SCHED] yield: acquire(&p->lock); p->state = RUNNABLE; swtch(); scheduler: swtch(); release(&p->lock); the main point of holding p->lock across swtch(): prevent another core’s scheduler from seeing p->state == RUNNABLE until after the...

2024-09-29 · 12 分钟 · 5655 字 · updated: 2024-10-03 · ShowGuan

MIT6.S081(11)- Thread switching

MIT6.S081(11)- Thread switching Topic: more “under the hood” with xv6 Previously: system calls, interrupts, page tables, locks Today: process/thread switching Why support multiple tasks? Time-sharing: many users and/or many running programs. program structure: prime number sieve. parallel speedup on multi-core hardware. Threads are an abstraction to simplify programming when there are many tasks. thread = an independent serial execution – registers, pc, stack the threading system interleaves the execution of...

2024-09-21 · 7 分钟 · 3091 字 · updated: 2024-09-21 · ShowGuan

MIT6.S081(10)-Locking

MIT6.S081(10)-Locking Why talk about locking? apps want to use multi-core processors for parallel speed-up so kernel must deal with parallel system calls and thus parallel access to kernel data (buffer cache, processes, &c) locks help with correct sharing of data locks can limit parallel speedup What goes wrong if we don’t have locks Case study: delete acquire/release in kalloc.c Boot kernel works! Run usertests all tests pass! except we lose...

2024-09-19 · 3 分钟 · 1303 字 · updated: 2024-09-19 · ShowGuan

MIT6.S081(9)-Interrupts

MIT6.S081(9)-Interrupts 6.S081 2020 Lecture 9: Interrupts Interrupts hardware wants attention now! e.g., pkt arrived, clock interrupt software must set aside current work and respond on RISC-V use same trap mechanism as for syscalls and exceptions new issues/complications: asynchronous interrupts running process interrupt handler may not run in context of process who caused interrupt concurrency devices and process run in parallel programming devices device can be difficult to program Where do...

2024-09-18 · 3 分钟 · 1303 字 · updated: 2024-09-18 · ShowGuan

MIT6.S081(8)-Page faults

MIT6.S081(8)-Page faults plan: cool things you can do with vm Better performance/efficiency e.g., one zero-filled page e.g., copy-on-write fork New features e.g., memory-mapped files virtual memory: several views primary purpose: isolation each process has its own address space Virtual memory provides a level-of-indirection provides kernel with opportunity to do cool stuff already some examples: shared trampoline page guard page but more possible… Key idea: change page tables on page fault...

2024-09-17 · 2 分钟 · 958 字 · updated: 2024-09-17 · ShowGuan

MIT6.S081(7)-Q&A

MIT6.S081(7)-Q&A Plan: answering your questions Approach: walk through staff solutions start with pgtbl lab because it was the hardest your questions are at bottom of this file Pgtbl lab comments few lines of code, but difficult-to-debug bugs worst case: qemu/xv6 stops running “best” case: kernel panic hard to debug for staff too there are so many possible reasons why you discovered once we hadn’t seen yet likely to be the...

2024-09-12 · 6 分钟 · 2628 字 · updated: 2024-09-12 · ShowGuan

MIT6.S081(6)-System Call Entry/Exit

MIT6.S081(6)-System Call Entry/Exit Today: user -> kernel transition system calls, faults, interrupts enter the kernel in the same way important for isolation and performance lots of careful design and important detail What needs to happen when a program makes a system call, e.g. write()? [CPU | user/kernel diagram] CPU resources are set up for user execution (not kernel) 32 registers, sp, pc, privilege mode, satp, stvec, sepc, … what needs...

2024-09-10 · 7 分钟 · 3445 字 · updated: 2024-09-10 · ShowGuan

MIT6.S081(5)-RISC-V calling convention, stack frames, and gdb

MIT6.S081(5)-RISC-V calling convention, stack frames, and gdb C code is compiled to machine instructions. How does the machine work at a lower level? How does this translation work? How to interact between C and asm Why this matters: sometimes need to write code not expressible in C And you need this for the syscall lab! RISC-V abstract machine No C-like control flow, no concept of variables, types … Base ISA:...

2024-09-04 · 5 分钟 · 2064 字 · updated: 2024-09-04 · ShowGuan

C 语言指针

C 语言指针 C语言中的内存 静态内存(Static Memory) Global variables, accessible throughout the whole program. Defined with static keywork, as well as variables defined in global scope. 栈内存(Stack Memory) Local variables with functions. Destroyed after function exits. 堆内存(Heap M...

2024-09-03 · 7 分钟 · 3219 字 · updated: 2024-09-03 · ShowGuan

MIT6.S081(4)-Virtual Memory

MIT6.S081(4)-Virtual Memory Plan: Address spaces Paging hardware xv6 VM code Virtual memory overview Today’s problem: [user/kernel diagram] [memory view: diagram with user processes and kernel in memory] Suppose the shell has a bug: sometimes it writes to a random memory address how can we keep it from wrecking the kernel? and from wrecking other processes? we want isolated address spaces each process has its own memory it can read and...

2024-09-02 · 12 分钟 · 5742 字 · updated: 2024-09-02 · ShowGuan

MIT6.S081(1)-O/S overview

MIT6.S081(1)-O/S overview Class Page Overview 6.S081 goals Understand operating system (O/S) design and implementation Hands-on experience extending a small O/S Hands-on experience writing systems software What is the purpose of an O/S? Abstract the hardware for convenience and portability Multiplex the hardware among many applications Isolate applications in order to contain bugs Allow sharing among cooperating applications Control sharing for security Don’t get in the way of high performance Support...

2024-08-31 · 12 分钟 · 5897 字 · updated: 2024-08-31 · ShowGuan

MIT6.S081(3)-OS organization

MIT6.S081(3)-OS organization Lecture Topic: OS design ​ system calls ​ micro/monolithic kernel First system call in xv6 OS picture apps: sh, echo, … system call interface (open, close,…) OS Goal of OS run multiple applications isolate them multiplex them share Strawman design: No OS Application directly interacts with hardware CPU cores & registers DRAM chips Disk blocks … OS library perhaps abstracts some of it Strawman design not conducive to...

2024-08-31 · 4 分钟 · 1800 字 · updated: 2024-08-31 · ShowGuan
© 2025 Kennem's Blog · Powered by Hugo & PaperMod
Visitors: Views: