c - what's the difference between the threads(and process) in kernel-mode and ones in user-mode? -


my question:

1)in book modern operating system, says threads , processes can in kernel mode or user mode, not what's difference between them .

2)why switch kernel-mode threads , process costs more switch user-mode threads , process?

3) now, learning linux,i want know how create threads , processes in kernel mode , user mode respectively in linux system?

4)in book modern operating system, says possible process in user- mode, threads created in user-mode process can in kernel mode. how possible?

user-mode threads scheduled in user mode in process, , process thing handled kernel scheduler.

that means process gets amount of grunt cpu , have share amongst user mode threads.

simple case, have 2 processes, 1 single thread , 1 hundred threads.

with simplistic kernel scheduling policy, thread in single-thread process gets 50% of cpu , each thread in hundred-thread process gets 0.5% each.

with kernel mode threads, kernel manages threads , schedules them independently. using same simplistic scheduler, each thread touch under 1% of cpu grunt (101 threads share 100% of cpu).

in terms of why kernel mode switching more expensive, has fact need switch kernel mode it. user mode threads stuff in user mode (obviously) there's no involving kernel in thread switch operation.

under linux, create threads (and processes) clone call, similar fork finer control on things.

your final point little obtuse. can't it's talking user , kernel mode in sense 1 executing user code , doing system call in kernel (which requires switching kernel or supervisor mode).

that's not same distinction when talking threading support (user or kernel mode support threading). without having copy of book hand, couldn't definitively, that'd best guess.


Comments

Popular posts from this blog

delphi - How to convert bitmaps to video? -

jasper reports - Fixed header in Excel using JasperReports -

python - ('The SQL contains 0 parameter markers, but 50 parameters were supplied', 'HY000') or TypeError: 'tuple' object is not callable -