Sunteți pe pagina 1din 12

3.

SO Windows
3.1.Principii de proiectare
3.2. Structura. Componente
3.3. Comenzi
3.4. Registry
3.5. Gestiunea memoriei
3.6. Procese si fire
3.7. Sistemul de fisiere
3.8. Interfata de programare
3.9. Componente de retea

Conf.dr.Carmen Timofte Sisteme de operare 1

3.6. Procese si fire

KERNEL

o Foundation for the executive and the subsystems


o Never paged out of memory; execution is never preempted
o Four main responsibilities:
o thread scheduling
o interrupt and exception handling
o low-level processor synchronization
o recovery after a power failure
o Kernel is object-oriented, uses two sets of objects
o dispatcher objects control dispatching and synchronization (events, mutants, mutexes, semaphores, threads
and timers)
o control objects (asynchronous procedure calls, interrupts, power notify, power status, process and profile
objects)

Conf.dr.Carmen Timofte Sisteme de operare 2

1
(*)

(*) Relatia dintre job-uri (task), procese, fire (threads), fibre (fibers)

Conf.dr.Carmen Timofte Sisteme de operare 3

(*) Some of Win32 calls for managing processes, threads and fibers

Conf.dr.Carmen Timofte Sisteme de operare 4

2
(*) Kernel Scheduling (Planificatorul)

o Dispecerul utilizeaz o schem cu 32 nivele de prioriti pt. a determina ordinea de


execuie a firelor;
o Prioritile sunt divizate n 2 clase:
o Clasa n timp-real conine fire cu prioriti ntre 16-31;
o Clasa variabil pt. prioriti ntre 0-15;
o Planificarea are loc atunci cnd:
o firul intr n starea ready sau wait,
o se termin
o aplicaia schimb prioritatea firului sau a procesorul alocat;
o Firele n timp-real au acces preferenial la CPU => realtime soft = XP nu garanteaz c
acel fir va ncepe execuia fr restricii particulare de timp;

Conf.dr.Carmen Timofte Sisteme de operare 5

(*) Prioritati

Mapping of Win32 priorities to Windows


2000 priorities
Windows 2000 supports 32 priorities for
threads

Windows XP Interrupt
Request Levels

Conf.dr.Carmen Timofte Sisteme de operare 6

3
3.7. Sistemul de fisiere

o The fundamental structure of the XP file system (NTFS) is a volume


o Created by the XP disk administrator utility
o Based on a logical disk partition
o May occupy a portions of a disk, an entire disk, or span across several disks
o All metadata, such as information about the volume, is stored in a regular file
o NTFS uses clusters as the underlying unit of disk allocation
o A cluster is a number of disk sectors that is a power of two
o Because the cluster size is smaller than for the 16-bit FAT file system, the amount of internal
fragmentation is reduced

Internal Layout
o NTFS uses logical cluster numbers (LCNs) as disk addresses
o A file in NTFS is not a simple byte stream, as in MS-DOS or UNIX, rather, it is a structured object
consisting of attributes
o Every file in NTFS is described by one or more records in an array stored in a special file called the
Master File Table (MFT)
o Each file on an NTFS volume has a unique ID called a file reference.
o 64-bit quantity that consists of a 48-bit file number and a 16-bit sequence number
o Can be used to perform internal consistency checks
o The NTFS name space is organized by a hierarchy of directories; the index root contains the top level of
the B+ tree

Conf.dr.Carmen Timofte Sisteme de operare 7

(*) Master File Table pt. NTFS

Atribute pt. inregistrarile MFT

Conf.dr.Carmen Timofte Sisteme de operare 8

4
(*)

Recovery
o All file system data structure updates are performed inside transactions that are logged
Before a data structure is altered, the transaction writes a log record that contains redo and undo
information
After the data structure has been changed, a commit record is written to the log to signify that the
transaction succeeded
After a crash, the file system data structures can be restored to a consistent state by processing the
log records
o This scheme does not guarantee that all the user file data can be recovered after a crash, just that the file
system data structures (the metadata files) are undamaged and reflect some consistent state prior to the
crash
o The log is stored in the third metadata file at the beginning of the volume
o The logging functionality is provided by the XP log file service

Security

o Security of an NTFS volume is derived from the XP object model


o Each file object has a security descriptor attribute stored in this MFT record
o This attribute contains the access token of the owner of the file, and an access control list that states the
access privileges that are granted to each user that has access to the file
Conf.dr.Carmen Timofte Sisteme de operare 9

(*)
Volume Management and Fault Tolerance
o FtDisk, the fault tolerant disk driver for XP, provides several ways to combine multiple SCSI disk drives
into one logical volume
o Logically concatenate multiple disks to form a large logical volume, a volume set
o Interleave multiple physical partitions in round-robin fashion to form a stripe set (also called RAID level
0, or disk striping)
o Variation: stripe set with parity, or RAID level 5
o Disk mirroring, or RAID level 1, is a robust scheme that uses a mirror set two equally sized partitions
on tow disks with identical data contents
o To deal with disk sectors that go bad, FtDisk, uses a hardware technique called sector sparing and NTFS
uses a software technique called cluster remapping

Compression

To compress a file, NTFS divides the files data into compression units, which are blocks of 16
contiguous clusters
For sparse files, NTFS uses another technique to save space
o Clusters that contain all zeros are not actually allocated or stored on disk
o Instead, gaps are left in the sequence of virtual cluster numbers stored in the MFT entry for the
file
o When reading a file, if a gap in the virtual cluster numbers is found, NTFS just zero-fills that
portion of the callers buffer

Conf.dr.Carmen Timofte Sisteme de operare 10

5
3.8. Interfata de programare

Access to Kernel Obj


A process gains access to a kernel object named XXX by calling the CreateXXX function to
open a handle to XXX; the handle is unique to that process
A handle can be closed by calling the CloseHandle function; the system may delete the object
if the count of processes using the object drops to 0
XP provides three ways to share objects between processes
o A child process inherits a handle to the object
o One process gives the object a name when it is created and the second process opens
that name
o DuplicateHandle function:
 Given a handle to process and the handles value a second process can get a
handle to the same object, and thus share it

Conf.dr.Carmen Timofte Sisteme de operare 11

Process Management
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 CreateThread function
Every dynamic link library or executable file that is loaded into the address space of a process is
identified by an instance handle
o Scheduling in Win32 utilizes four priority classes:
o IDLE_PRIORITY_CLASS (priority level 4)
o NORMAL_PRIORITY_CLASS (level8 typical for most processes
o HIGH_PRIORITY_CLASS (level 13)
o 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
o XP distinguishes between the foreground process that is currently selected on the screen, and the
background processes that are not currently selected
o When a process moves into the foreground, XP increases the scheduling quantum by some factor,
typically 3
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
o In addition, threads can synchronize by using the WaitForSingleObject or
WaitForMultipleObjects functions
o Another method of synchronization in the Win32 API is the critical section
A fiber is user-mode code that gets scheduled according to a user-defined scheduling algorithm
o Only one fiber at a time is permitted to execute, even on multiprocessor hardware
o XP includes fibers to facilitate the porting of legacy UNIX applications that are written for a fiber
execution model

Conf.dr.Carmen Timofte Sisteme de operare 12

6
(*)

Interprocess Comm.
Win32 applications can have interprocess communication by sharing kernel objects
An alternate means of interprocess communications is message passing, which is particularly
popular for Windows GUI applications
One thread sends a message to another thread or to a window
A thread can also send data with the message
Every Win32 thread has its own input queue from which the thread receives messages
This is more reliable than the shared input queue of 16-bit windows, because with separate
queues, one stuck application cannot block input to the other applications

Conf.dr.Carmen Timofte Sisteme de operare 13

(*)
Memory Management
Virtual memory:
o VirtualAlloc reserves or commits virtual memory
o VirtualFree decommits or releases the memory
These functions enable the application to determine the virtual address at which the memory
is allocated

An application can use memory by memory mapping a file into its address space
o Multistage process
o Two processes share memory by mapping the same file into their virtual memory
A heap in the Win32 environment is a region of reserved address space
o A Win 32 process is created with a 1 MB default heap
o Access is synchronized to protect the heaps space allocation data structures from
damage by concurrent updates by multiple threads
Because functions that rely on global or static data typically fail to work properly in a
multithreaded environment, the thread-local storage mechanism allocates global storage on a
per-thread basis
o The mechanism provides both dynamic and static methods of creating thread-local
storage

Conf.dr.Carmen Timofte Sisteme de operare 14

7
3.9. Componente de retea

Protocoale de reea
o Suport comunicaii:
o Peer-to-peer
o Client/server
o Suport management de reea;
o Suport 2 interfee de reea interne:
o NDIS (Network Device Interface Specification) ofer adaptoare de reea separate pt. protocoale de
transport, care pot fi schimbate fr a le afecta pe celelalte;
o TDI (Transport Driver Interface) permite componentelor de nivel sesiune s foloseasc orice
mecanism de transport.
o Win (XP) implementeaz protocoalele de transport ca driver-e, care pot fi ncrcate/descrcate dinamic

Conf.dr.Carmen Timofte Sisteme de operare 15

(*) Protocoale de reea


o SMB (Server Message Block) is used to send I/O requests over the network. It has four
message types:
o Session control
o File
o Printer
o Message
o NetBIOS (The network Basic Input/Output System) is a hardware abstraction interface for
networks, used to:
- Establish logical names on the network
- Establish logical connections of sessions between two logical names on the network
- Support reliable data transfer for a session via NetBIOS requests or SMBs
o NetBEUI (NetBIOS Extended User Interface) default protocol for Windows 95 peer
networking and Windows for Workgroups; used when XP wants to share resources with
these networks; XP uses the TCP/IP Internet protocol to connect to a wide variety of
operating systems and hardware platforms
o PPTP (Point-to-Point Tunneling Protocol) is used to communicate between Remote Access
Server modules running on XP machines that are connected over the Internet
o The XP NWLink protocol connects the NetBIOS to Novell NetWare networks
o The Data Link Control protocol (DLC) is used to access IBM mainframes and HP printers
that are directly connected to the network
o XP systems can communicate with Macintosh computers via the Apple Talk protocol if an
XP Server on the network is running the Windows XP Services for Macintosh package

Conf.dr.Carmen Timofte Sisteme de operare 16

8
(*) NetBIOS/NetBEUI

 NetBIOS (Network Basic Input/Output System) a fost creat n 1984 de


IBM i Sytek i reprezint o facilitate de comunicare ntre programele din
calculatoarele de tip PC care opereaz ntr-o reea.
 NetBIOS faciliteaz comunicarea prin trei servicii de baz: servicul de
nume, serviciul de sesiuni, serviciul de datagrame.
NetBEUI (NetBIOS Extended Servicii fiiere, im primare, altele
Aplicaie Redirector
User Interface) - defineste
funciile din cadrul NetBIOS care
opereaz la nivelul protocolului de Prezentare
comunicaie, (diferenierea ntre NetBIOS
acest nivel i nivelul serviciilor.) Sesiu ne

SMB (System Message Transport


Blocks), - faciliti la nivelul TCP/IP SPX/IPX NetBEUI Altele
aplicaie, necesare pentru Reea
implementarea serviciilor de
Legtura Gestionar Protocol
partajare a fiierelor, de imprimare
sau a altor servicii orientate de date Driver NDIS
utilizator.
Fizic Ethernet Token Ring T oken Bus Altele
Conf.dr.Carmen Timofte Sisteme de operare 17

(*) Distributed Processing Mechanisms

o XP supports distributed applications via named NetBIOS, named pipes and


mailslots, Windows Sockets, Remote Procedure Calls (RPC), and Network
Dynamic Data Exchange (NetDDE)
 NetBIOS applications can communicate over the network using NetBEUI,
NWLink, or TCP/IP
 Named pipes are connection-oriented messaging mechanism that are
named via the uniform naming convention (UNC)
 Mailslots are a connectionless messaging mechanism that are used for
broadcast applications, such as for finding components on the network
 Winsock, the windows sockets API, is a session-layer interface that
provides a standardized interface to many transport protocols that may have
different addressing schemes
 The XP RPC mechanism follows the widely-used Distributed Computing
Environment standard for RPC messages, so programs written to use XP
RPCs are very portable
RPC messages are sent using NetBIOS, or Winsock on TCP/IP
networks, or named pipes on LAN Manager networks
XP provides the Microsoft Interface Definition Language to describe
the remote procedure names, arguments, and results

Conf.dr.Carmen Timofte Sisteme de operare 18

9
Domains
o NT uses the concept of a domain to manage global access rights within groups
o A domain is a group of machines running NT server that share a common security
policy and user database
o XP provides three models of setting up trust relationships
 One way, A trusts B
 Two way, transitive, A trusts B, B trusts C so A, B, C trust each other
 Crosslink allows authentication to bypass hierarchy to cut down on
authentication traffic

Name Resolution in TCP/IP Networks


o On an IP network, name resolution is the process of converting a computer name to an IP
address
e.g., www.bell-labs.com resolves to 135.104.1.14
o XP provides several methods of name resolution:
 Windows Internet Name Service (WINS)
 broadcast name resolution
 domain name system (DNS)
 a host file
 an LMHOSTS file
o WINS consists of two or more WINS servers that maintain a dynamic database of name to IP
address bindings, and client software to query the servers
o WINS uses the Dynamic Host Configuration Protocol (DHCP), which automatically updates
address configurations in the WINS database, without user or administrator intervention

Conf.dr.Carmen Timofte Sisteme de operare 19

All People Seem To Need Data Processing

Conf.dr.Carmen Timofte Sisteme de operare 20

10
Modelul ISO/OSI

PDU
Protocol
DataUnits
-unitati
de date
ale
protocoa
lelor;
-relative
la nivel;
-alcatuite
din antet
+corp;

Conf.dr.Carmen Timofte Sisteme de operare 21

Modelul TCP/IP
 Comparatie ISO/OSI, TCP/IP

Conf.dr.Carmen Timofte Sisteme de operare 22

11
Modelul ISO/OSI (*)
 Nivelul fizic (Physical) realizeaz transmisia electric a unui ir de bii,
fr a se verifica corectitudinea acesteia. Nivelul fizic este n strns
legtur cu mediul fizic de transmisie a datelor. La acest nivel se
specific: tipul de cablu, conectorul de legtur, rata de transfer, metoda
de codificare a datelor, metoda de acces la mediul de transmisie.

 Nivelul legtur date (Data Link) asigur transmiterea corect a datelor ntre dou
sisteme ntre care exist o legtur fizic. Secvena de date este mprit n frame-
uri (cadre). Staia receptoare face verificarea sumei de control asociat cadrului.

 Nivelul reea (Network) asigur dirijarea cadrelor prin reea, stabilind calea de
transmisie a datelor de la surs la destinaie. Poate asigura multiplexarea mai
multor comunicatii pe aceeasi legatura de date.

1-3 inlantuite; 4-7 cap-la-cap;

 Nivelul transport (Transport) asigur transmisia corect a datelor ntre staia surs
i staia destinaie (de tip punct-la-punct), realizeaz secvenierea mesajelor,
sincronizeaz ritmul de transmisie i asigur retransmisia mesajelor pierdute sau
eronate.

Conf.dr.Carmen Timofte Sisteme de operare 23

Modelul ISO/OSI (*)


 Nivelul sesiune (Session) realizeaz conexiuni logice ntre procesele
constituente ale unei aplicaii, asigurnd dialogul direct ntre aceste
procese (initializarea, sincronizarea, terminarea dialogului).

 Nivelul prezentare (Presentation) defineste semantica si sintaxa datelor


care se vor schimba. Se lucreaz cu o reprezentare abstract a datelor,
valabil n toat reeaua, asigurndu-se conversia n formate specifice de
reprezentare la nivelul calculatoarelor, terminalelor etc. n unele aplicaii
se asigur compresia datelor i criptarea lor.

 Nivelul aplicaie (Application) asigur utilizatorului mijloacele necesare de


acces la mediul OSI. Se ocupa de semantica aplicatiei. Serviciile de baz
ale reelei: pota electronic - e-mail, transferul de fiiere, accesul la
distan.

Conf.dr.Carmen Timofte Sisteme de operare 24

12

S-ar putea să vă placă și