1 / 32

Procesi in niti pri Windows NT

Procesi in niti pri Windows NT. Procesi in niti. Primeri sistemskih niti. 4 konteksti izvajanja kode. The process has a virtual memory address space, information (such as a base priority), and an affinity for one or more processors.

rocco
Download Presentation

Procesi in niti pri Windows NT

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Procesi in niti pri Windows NT

  2. Procesi in niti

  3. Primeri sistemskih niti

  4. 4 konteksti izvajanja kode

  5. The process has a virtual memory address space, information (such as a base priority), and an affinity for one or more processors. Threads are the unit of execution scheduled by the kernel’s dispatcher. Each thread has its own state, including a priority, processor affinity, and accounting information. A thread can be one of six states: ready, standby, running, waiting, transition, and terminated. Procesi in niti

  6. Dostopni žeton Opisniki virtualnega naslovnega prostora Proces ... Tabela ročic do objektov Thread x . . . Handle 1 File y Handle 2 Sekcija z Handle 3 Objekti, z dovoljenim dostopom

  7. Virtual address space (including program global storage, heap storage, threads’ stacks) processes cannot corrupt each other’s address space by mistake Working set (physical memory “owned” by the process) Access token (includes security identifiers) Handle table for Win32 kernel objects These are common to all threads in the process, but separate and protected between processes Vsak proces ima svoje lastno…

  8. Stack (automatic storage, call frames, etc.) Instance of a top-level function Scheduling state (Wait, Ready, Running, etc.) and priority Current access mode (user mode or kernel mode) Saved CPU state if it isn’t Running Access token (optional -- overrides process’s if present) Vsaka nit ima svoj …

  9. The dispatcher uses a 32-level priority scheme to determine the order of thread execution. Priorities are divided into two classes. The real-time class contains threads with priorities ranging from 16 to 31. The variable class contains threads having priorities from 0 to 15. Characteristics of XP’s priority strategy. Trends to give very good response times to interactive threads that are using the mouse and windows. Enables I/O-bound threads to keep the I/O devices busy. Complete-bound threads soak up the spare CPU cycles in the background. Kernel — razvrščanje

  10. Scheduling can occur when a thread enters the ready or wait state, when a thread terminates, or when an application changes a thread’s priority or processor affinity. Real-time threads are given preferential access to the CPU; but XPdoes not guarantee that a real-time thread will start to execute within any particular time limit. (This is known as soft realtime.) Kernel — razvrščanje(nadaljevanje.)

  11. Process is started via the CreateProcess routine which loads any dynamic link libraries that are used by the process, and creates a primary thread. Additional threads can be created by the CreateThreadfunction. Every dynamic link library or executable file that is loaded into the address space of a process is identified by an instance handle. Programmer Interface — Process Management

  12. Scheduling in Win32 utilizes four priority classes: IDLE_PRIORITY_CLASS (priority level 4) NORMAL_PRIORITY_CLASS (level8 — typical for most processes HIGH_PRIORITY_CLASS (level 13) REALTIME_PRIORITY_CLASS (level 24) To provide performance levels needed for interactive programs, XP has a special scheduling rule for processes in the NORMAL_PRIORITY_CLASS. XP distinguishes between the foreground process that is currently selected on the screen, and the background processes that are not currently selected. When a process moves into the foreground, XP increases the scheduling quantum by some factor, typically 3. Process Management (Cont.)

  13. The kernel dynamically adjusts the priority of a thread depending on whether it is I/O-bound or CPU-bound. To synchronize the concurrent access to shared objects by threads, the kernel provides synchronization objects, such as semaphores and mutexes. In addition, threads can synchronize by using the WaitForSingleObject or WaitForMultipleObjects functions. Another method of synchronization in the Win32 API is the critical section. Process Management (Cont.)

  14. A fiber is user-mode code that gets scheduled according to a user-defined scheduling algorithm. Only one fiber at a time is permitted to execute, even on multiprocessor hardware. XP includes fibers to facilitate the porting of legacy UNIX applications that are written for a fiber execution model. Process Management (Cont.)

  15. Basic concepts used for CPU and resource management Processes and Threads (1)

  16. Relationship between jobs, processes, threads, and fibers Processes and Threads (2)

  17. Razvrščanje pri Windows 2000 • Windows 2000 schedules at the thread granularity. • Priority-driven, preemptive scheduling system – The highest-priority runnable thread always runs. – Time-sliced, round-robin within a priority level. • Windows 2000 uses 32 priority levels – System level (0), Variable levels (1-15), Real-time levels (16-31) • From Win32 point of view – Processes are given a priority class upon creation: » Idle, Below Normal, Normal, Above Normal, High, Real-time » Changeable by Task Manager. – The individual threads have a relative priority within the class: » Idle, Lowest, Below-Normal, Normal, Above Normal, Highest, Time-Critical

  18. Prioritete jedra pri Windows 2000

  19. Mapping of Win32 priorities to Windows 2000 priorities Scheduling (1)

  20. Windows 2000 supports 32 priorities for threads Scheduling (2)

  21. An example of priority inversion Scheduling (3)

  22. Some of Win32 calls for managing processes, threads and fibers Job, Process, Thread & Fiber Mgmt. API Calls

  23. CPE je zasedena – zakaj le?

  24. Kateri proces teče?

  25. Process explorer (Sysinternals) Process tree If left justified, parent has exited Disappears if you sort by any column Bring back with View->Show Process Tree Additional details in process list Icon and description (from .EXE) User Name shows domain name Highlight Own, Services Processes Differences highighting Green: new, Red: gone View->Update speed->Paused

  26. 32 bitni virtualni naslovni prostor (x86)

  27. Proces in uporaba pomnilnika: “delovna množica”

  28. Zamenjava delovne množice

  29. Podatki o pomnilniku za proces

  30. Souporabljen pomnilnik

  31. Vpogled v delovne množice

  32. Življenje servisa

More Related