楼主: yclu
跳转到指定楼层
上一主题 下一主题
收起左侧

Udacity/ud923/Intro to Operating System

🔗
ilove6169 2019-1-15 23:46:13 | 只看该作者
全局:
推荐清华的OS课,也不错吧~~~~
回复

使用道具 举报

🔗
 楼主| yclu 2019-1-16 00:19:08 | 只看该作者
全局:
L7: Threads design consideration(这章内容和L5一样有点多,主要环绕在两篇paper提出的实作建议上)
Take way notes:
* Rationale of multiple data structures: 因为下列四个原因,所以在设计上有多种数据结构
    - scalability: 每种数据结构都不大
    - overheads: 设计的结构使得threads之间共享了数据,减少转换成本
    - performance: 在转换threads,只有少数的context data需要被更动
    - flexibility: ULTs只需要更动部分的数据
* User level threads(ULTs)
    - threads有一个table pointers去管理,每个pointer会指到对应的数据结构
    - 会有stack管理的风险
* Kernel level threads(KLTs)
    - pinning: KLT和CPU绑在一起的行为
    - bound: KLT和ULT绑在一起的行为
* Synchronization issue
    - 当有mutex的thread在不同的cpu上时,并且critical section较短,我们让当前cpu空转而不是block。但critical section较长时,则使用block
* Interrupts
    - 由cpu之外的单元产生,例如I/O, timers
    - 由不同的单元定义
    - 不和cpu同步
    - 有mask
* Signals
    - 由cpu或者软件产生
    - 由OS定义
    - 和/不和cpu同步
    - 有mask
回复

使用道具 举报

🔗
 楼主| yclu 2019-1-16 00:31:47 | 只看该作者
全局:
ilove6169 发表于 2019-1-15 23:46
推荐清华的OS课,也不错吧~~~~

感谢分享。回头再去看看
回复

使用道具 举报

🔗
Coherence 2019-1-16 05:31:51 | 只看该作者
全局:
ilove6169 发表于 2019-1-15 23:46
推荐清华的OS课,也不错吧~~~~

同感觉还可以~
回复

使用道具 举报

🔗
 楼主| yclu 2019-1-19 17:41:55 | 只看该作者
全局:
L9: Threads performance consideration(这章内容蛮实用,给了一些指标和方法去衡量不同web server实作方式)
Take way notes:
* Comparison between multi-process(MP), multi-threads(MT), and event-driven(ED) on web server
    - For a client, the performance metrics could be response time. But for the server, the metrics could be throughput.
    - threads 不能肯定一定有用,须取决于metrics 和work loads
    - For MP, 编程简单。但需使用较多memory, context switch成本提高,shared state维护成本提高
    - For MT, MP的翻版,优势变劣势,劣势变优势
    - For ED, 避免context switch, memory需求较小,没有同步问题所以编程简单
* What is event-driven architecture
    - a single process, a single thread of control
    - event dispatcher用于接收request, 处理disk read, 送出结果。可用state machine来表示dispatcher
    - 一个request可被拆分成多个handler来部分处理,这个设计可以用来达成concurrency
    - 利用asynchronous来解决blocking的问题
* Design experiments tips
    - 从实用场景下,挑选有意义的metrics
    - 设置正确的实验场景
        - 硬体: CPU, memory
        - 软体: number of threads, queue sizes
        - work load: requests rate, file size
回复

使用道具 举报

🔗
 楼主| yclu 2019-1-23 01:30:09 | 只看该作者
全局:
L11: Scheduling(这章帮助理解scheduler如何安排threads/process到CPU上运作)
Take way notes:
* What is a scheduler for: scheduler决定proceess/threads何时和如何取得共享的cpu
* scheduling mechanisms:
    - first come first serve(FCFS)
    - shortest job first (SJF)
    - Round Robin scheduling
    - time slicing scheduling: 短任务可以较快完成,I/O费时的任务可以提早开始,但需要有overheads
* 任务可以区分为cpu-bound或者i/o-bound
* linux scheduling algorithms
    - O(1): 在interactive任务上表现不好
    - CFS: 用red-black来实作
* scheudling on multi-CPU
    - 一颗cpu有多个transistor来减少context switch的成本
    - 需要硬体counter的设计来帮助scheduler快速辨别threads/process的计算成本
    - 理论上,scheduler需配置ipc(instructions per cycle)多样化的thread/process到每颗cpu上
    - 实际上,每个thread/process的ipc差别不大
回复

使用道具 举报

🔗
 楼主| yclu 2019-2-3 16:17:38 | 只看该作者
全局:
L12 / Memory Management(这章有点复杂,尤其是在计算page table时)

* How does OS manage virtual/physical memory
    - Allocation
        - allocate/replace spaces between virtual and physical memory
        - For page based management, it means that allocate pages(virtual) to page frames(physical)
    - Arbitration
        - address translation and validate address
        - For page based management, it's implemented by page tables
        - For segment based management, it's implemented by segment registers
    - OS has hardwares support in CPU package called MMU
* Memory management mechanisms
    - Page based mechanism
        - physical/virtual pages have the same size, so that they only stores the beginning entry point and its offset
        - For the purpose of validation, it also stores the validation bits called flags, such as the right of writing.
        - Multi-level pages helps better utilize the space in physical memory since a process will not fully used the virtual memory it gets.
        - When pages should be swapped out
            - when memory usage is above a threshold
            - when cpu usage is below a threshold
        - Which pages should be swapped out
            - pages that won't be used by using policies such as LRU
            - pages that won't be written out
    - Segment based mechanism
        - It will have un-fixed memory size like page based does.
        - It's often used with pages.
* Memory Allocator
    - It's used to determine VA to PA mapping
    - It has different levels, kernel-level and user-level.
        - For kernel-level allocator, it allocates memory for kernel including kernel states and static process state
        - For user-level allocator, it allocates memory for user-level process including dynamic process state(heap), malloc/free
    - One memory allocation challenge is aggregation of free memory(简单来说,就是如何有效合并闲置的小记忆区块成一个大的区块)
        - buddy allocator: it divides memory into the power of 2 memory size
        - slab allocator: it uses internal fragmentation to create custom size for different purposes
回复

使用道具 举报

🔗
 楼主| yclu 2019-2-5 11:33:15 | 只看该作者
全局:
L13 / Inter Process Communication(这张有点杂,内容蛮琐碎)

* Common Mechanism
    - message based, such as sockets, pipes, message queues
    - memory based, such as shared memory, memory mapped files
    - higher level semantics, such as files, RPC
    - synchronization primitives
* Comparison between message based and memory based
    - memory based mechanism copy data to/from port, but memory based mechanism map address into address space
    - time cost of copying is much larger than the one of mapping
回复

使用道具 举报

🔗
 楼主| yclu 2019-2-6 00:32:04 | 只看该作者
全局:
L14 / Synchronization constructs (这章主要讨论这篇文章, "The Performance of Spin Lock Alternatives for Shared-Memory Multiprocessors")

* Limitation of synchronization
    - it's not an error prone approach
    - it lacks of express power
    - it needs lower level supports from hardware
* Different types of synchronization constructs
    - Spinlock: it's like a mutex. but the difference is that it's spinning when the lock is busy instead of locked
    - Semaphores: it's like a traffic light
    - monitor, read/write lock, serializers
* Hardware supported synchronization
    - atomic instruction: it guarantees that atomicity, mutual exclusion, and "queue all concurrent instructions but one"
    - shared memory coherence
        - write invalidate: lower bandwidth amortize cost
        - write update: update available immediately
回复

使用道具 举报

🔗
wowmomsos 2019-2-6 01:08:27 | 只看该作者
全局:
ilove6169 发表于 2019-1-15 23:46
推荐清华的OS课,也不错吧~~~~

同学我看了一下,xuetangx上的os课有好几门,您说的是哪门呢?
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 注册账号
隐私提醒:
  • ☑ 禁止发布广告,拉群,贴个人联系方式:找人请去🔗同学同事飞友,拉群请去🔗拉群结伴,广告请去🔗跳蚤市场,和 🔗租房广告|找室友
  • ☑ 论坛内容在发帖 30 分钟内可以编辑,过后则不能删帖。为防止被骚扰甚至人肉,不要公开留微信等联系方式,如有需求请以论坛私信方式发送。
  • ☑ 干货版块可免费使用 🔗超级匿名:面经(美国面经、中国面经、数科面经、PM面经),抖包袱(美国、中国)和录取汇报、定位选校版
  • ☑ 查阅全站 🔗各种匿名方法

本版积分规则

>
快速回复 返回顶部 返回列表