User-level and kernel-level thread comparison and which one to choose in what circustance

  1. What are the two advantages that threads have over multiple processes? [2 marks]
    1. Inter-thread communication is easier/faster than inter-process communication.
    2. Threads incur less overhead to create/terminate/switch
  2. What are the differences between user-level threads and kernel-level threads and under what circumstances is one type better than the other? [4 marks]
    1. User-level threads:
      1. Threads are in user space. Thus, no mode switches required
      2. Full control over the thread shceduler (e.g. website server)
      3. OS independent (threads can run on OS that do not support them).
      4. The runtime system can switch local blocking threads in user space. (e.g. wait for another thread to complete)
      5. Cons1: Blocking system calls suspend the entire process s(user threads are mapped onto a single process, managed by the kernl).
      6. Cons2: page fault result in blocking the process
      7. Cons3: No true parallelism (a process is scheduled on single CPU)
    2. Kernel-level thread: (Windows, linux)
      1. Pro: true parallelism can be achieved.
      2. Pro2: no run-time system needed.
      3. Cons: frequence mode switch take place, resulting in lower performance.
    3. Hybrid implementations
      1. Implementation: user threads are multiplexed onto kernel threads.
      2. Kernel sees and schedules the kernel threads (a limited number)
      3. User application sees user threads and create/schedules these (an “unrestricted” number)
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值