:
() - , ( ) . [, 2001].
, , (, ).
- , . , , -. .
. . . . , . 5, .
, .
50- XX . General Motors IBM-701. 60- XX . . 7.2 .
[Silberschatz-Galvin 1995].
"" , NACHOS (Not Another Completely Heuristic Operating System), (Wayne Christopher), (Steve Procter) (Thomas Anderson) 1992 . (http://www.stanford.edu/class/csl40/projects/).
() (. 7.3).
, .
[Tanenbaum 1995]. . 6 , ( ) . , .
.
, (. 7.4).
[, 2001], .
, , . . 6.1.3.1 . , .
, :
.
. , , - .
, .
, .
: ,
- . Windows?
: Windows Unix. "" . .
. 7.1, . 7.2 .
7.1.
Pentium (Intel) | Alpha (DEC) | SuperSparc (Sun) | PA7100 (HP) | |
Windows | Windows | - | - | - |
OS/2 | OS/2 | - | - | - |
Unix | Solaris, SCO | OSF1 | Solaris, SunOS | HP-UX |
7.2.
- |
- |
(1996 ) | (2000 ) | |
MS-DOS | x86 | Pentium | 180 000 000 | 5 000 000 |
Windows 3.* | x86 | Pentium | 130 000 000 | 5 000 000 |
Windows 9, 2 | Pentium | 86 | 60 000 000 | 300 000 000 |
Windows NT | Pentium | Power PC, Alpha | 3 000 000 | 40 000 000 |
IBM OS/2 | Pentium | x86 | 12 000 000 | 25 000 000 |
Macintosh | Power PC | 680 | 25 000 000 | 35 000 000 |
Sun Solaris | SPARC | Pentium | 1 500 000 | 10 000 000 |
Unix | 6 000 000 | 20 000 000 |
, , .
. :
. :
. , .
(process), .
60- XX MULTICS.
, :
. , - , - .
(. 7.6):
:
7.1 , Unix.
7.1. Unix
void main() {7.2 , Windows.
7.2. Windows
void main() {() (thread) - . ( ) ().
. , . , , . , .
, :
Solaris. () (. 7.7).
, , 80- XX , . 1995 . IEEE POSIX 1003.1-1995. , , . :
. : ( , ).
7.3 , POSIX Solaris. , :
% thread_example. -Ithread -Ipthread7.3. POSIX Solaris
#define _REENTRANT
#include <pthread.h>
#include <thread.h> #define NUM_THREADS 5
#define SLEEP_TIME 10 void *sleeping(void
*); /* , */
int i;
thread_t tid[NUM_THREADS]; /* */
void main(int argc, char *argv[]){
switch ( *argv[1]) (
case '0' : /* POSIX */
for ( i = 0; i < NUM_THREADS; i++)
pthread_create(&tid[i],
NULL, sleeping, SLEEP_TIME);
for ( i = 0; i < NUM_THREADS; i++)
pthread_join(tid[i],
NULL);
break;
case '1': /* Solaris */
for ( i = 0; i < NUM_THREADS; i++)
thr_create(NULL,0,sleeping,NULL,0,&tid[i]);
while (thr_join(NULL, NULL, NULL)
== 0)
;
break;
} /* switch */
printf("Bce %d \n", i);
}
(signals) - , Unix. , [Lewine 1995].
:
:
:
7.4 Pascal, SIGSEGV.
7.4. SIGSEGV
program SegmentationViolation;7.5 , .
7.5.
#include <signal.h><Ctrl>+<C> :
% .out
2
7.6 , . .
7.6.
#include <signal.h>
#include <setjmp.h>
static jmp_buf jb;
static void reaction (int i){
printf(" %d \n", i);
longjmp(jb, i);
}
void main(){
if (signal(SIGINT, SIG_IGN) != SIG_IGN)
signal(SIGINT, reaction);
if (!setjmp(jb))
printf(" setjmp
\n");
else
printf(" longjmp
\n");
printf(" \");
while (1);
}
<Ctrl>+<C> :
% a.out
setjmp
2
longjmp
%
, . :
- .
- , . , , .
-- , . , .. . ( ) - .
- - -. . , , .
- , . , - .
, ( ). , :
:= + 1.
- , .
7.7 . . :
7.7.
enum state { UNLOCKED, LOCKED
};
typedef struct {
char status [2]; /*
*/
char turn; /*
*/
} lock_t;
void init_lock(lock_t* lock) {
lock->status[0]
= UNLOCKED;
lock->status[1]
= UNLOCKED;
lock->turn
= 0;
}
void lock(volatile lock_t*
lock) {
/*
*/
lock->status[cur_proc_id()] = LOCKED;
/* ,
*/
while ( lock->status[other_proc_id()] == LOCKED) (
/* ,
- */
if ( lock->turn != cur_proc__id () ) {
lock->status[cur_proc_id())
= UNLOCKED;
while ( lock->turn == other_proc_id())
;
lock->status[cur_proc_id()]
= LOCKED;
}
}
}
void unlock(lock_t* lock) {
lock->status[cur_proc_id()] = UNLOCKED;
lock->turn = other_proc_id();
}
- test_and_set(a, b) ( ). . , - . :
. , S PARC- idstub (load store unsigned byte) (. . 6.4.3.6):
Idstub [addr] , reg
addr reg, addr . 7.8 test_and_set idstub.
7.8. test_and_set
int test_and_set (volatile int*
addr) {
asm (Idstub [addr], reg);
if ( reg
= 0)
return
0;
return 1;
}
- , . , , , . 7.9 test_and_set.
7.9.
typedef int lock_t;
void init_lock(lock_t* lock_status)
{
*lock_status
= 0;
}
void lock(volatile lock_t* lock_status) {
while (
test_and_set(lock_status) == 1)
;
}
void unlock(lock_t* lock_status)
{
*lock_status
= 0;
}
. 7.10 .
7.10.
enum state { UNLOCKED, LOCKED
};
typedef int lock_t;
void init_lock(lock_t* lock)
{
*lock =
UNLOCKED;
}
void lock (volatile lock_t* lock) {
disable_interrupts;
/* */
while (
lock != UNLOCKED) {
enable_interrupts;
/* */
disable_interrupts;
}
lock =
LOCKED;
enable_interrupts;
}
void unlock(lock_t* lock)
{
disable_interrupts;
lock =
UNLOCKED;
enable_interrupts;
}
- , v . 60- XX . :
P(S): if ( S>0)
then
S:=S-1
else
__(S)
V(S): if ( ___(3))
then
_ (S)
else
S:=S+1.
, v (, ). , . Proberen - Verhogen - .
, , :
7.11.
7.11.
typedef struct {
lock_t lock; /*
*/
int count; /*
*/
proc_t* head; /* */
proc_t* tail
} sema_t;
void init_sema(sema_t* seraa, int initial_count) {
init_lock(&sema->lock);
sema->head = NULL;
sema->tail = NULL;
sema-> count = initial_count;
}
void P(sema_t* sema) {
lock(&sema->lock);
sema->count-- ;
if ( sema->count < 0) {
if ( sema->head == NULL)
sema->head = u.u_procp;
else
sema->tail~>p_next = u.u_procp;
u.u_procp->p_next = NULL;
sema->tail = u.u_procp;
unlock(&sema->lock);
switch();
return;
}
unlock(&sema->lock);
}
void V(sema_t* sema) {
proc_t* p;
lock(&sema->lock);
sema->count++;
if ( sema->count <= 0) {
p = sema->head;
sema->head = p->p_next;
if ( sema->head == NULL)
sema->tail = NULL;
unlock(ssema->lock);
enqueue(Srunqueue, p);
return;
}
unlock(&sema->lock);
}
- , , , .
. . , , , , . .
:
. (condition variable). , , wait (_) signal(_).
7.12 . , Pascal, monitor.
7.12.
monitor sema;
var
s: integer =
1; /* , */
res_is_free:
cond_t;
procedure P; /*
*/
begin
if s = 1
then s := 0
else wait(res_is_free)
end;
procedure V; /*
*/
begin
s := 1;
signal(res_is_free)
end;
end monitor;
Ada - task (). . , accept . . .
"-". "" , "" . , . . 7.13-7.16 , , Ada, .
7.13.
char buf[N];
int head = 0, tail =0, n =
0;
lock_t lock_status;
void put(char c) {
while ( n ==
N)
wait ();
lock(lock_status);
buf[head] = c;
head = (head
+ 1)%N;
n++;
unlock(lock_status)
;
}
char get() (
while ( n ==
0)
wait ();
lock(lock_status);
= buf[tail];
tail = (tail
+ 1)%N;
n--;
unlock(lock_status);
return c;
}
7.14.
char buf[N];
int head = 0, tail = 0;
sema_t holes, chars;
init_sema(holes, N);
init_sema(chars, 0);
void put(char c) {
P(holes);
buf[head] = c;
head = (head
+ 1)%N;
V(chars);
}
char get() {
P(chars);
= buf[tail];
tail = (tail
+ 1)%N;
V(holes);
return c;
}
7.15.
char buf[N];
int head = 0, tail = 0, n
= 0;
cond_t not_empty, not_full;
void put(char c) {
while (n = N)
wait(not_full);
buf[head] = c;
head = (head
+ 1)%N;
n++;
signal(not_erapty);
}
char get() {
while (n == 0)
wait(not_empty);
= buf[tail];
tail = (tail
+ 1)%N;
n--;
signal(not_full);
return c;
}
7.16. Ada
task body Buffer is
buf: array(0..N-1)
of CHAR;
head, tail: INTEGER range 0..N-1 := 0;
n: INTEGER range 0..N := 0;
begin
loop
select
when
n < N => accept put(in c: CHAR) do
buf[head]
= c;
end;
n
+:= 1;
head
= (head + 1) mod N;
or
when
n > 0 => accept get(out c: CHAR) do
= buf[tail];
end;
n
-:= 1;
tail
= (tail + 1) mod N;
end select;
end loop;
end Buffer;
"-". , . -"" , -"". "" , , , . "" .
- . - ( - , - ). ( ) : .
- , . - .
- , ( , ).
, .
[, 1977].
.
( , ) , .
. . 7.8 (. 7.8, ) ( ) () (. 7.8, ).
() . - (.. , ) . , . :, .
- : . , - , - .
- , - . - () . , - , , . , , , . , , .
, , . , . , , , "". , .
. 7.9 .
, 1 2, / . P11 21. , 1 ( ). 2, . 12. .
. , (""). " ", .
- , (), ( ). - .
.
.
.
- , . :
.
- , .
- . :
. . , .
- (Open Systems Interconnections - OSI), ISO. :
- GOSIP (Government OSI Profile), . , , , [, , , 1999]:
, .
TCP/IP
1969 TCP/IP (Transfer Control Protocol/Internet Protocol). . OSI TCP/IP.
TCP/IP (. 7.10). [Stevens 1994].
:
, - ,
-, -.
. . " "
, :
, , (. 7.11).
TCP/IP [, , , 1999]:
IP-
IP- - , , TCP/IP.
:
IP- , . IP-. - . :
0, 127 255 IP-. 224-239, , 240-254, .
, . - IPv4 32- . IPv6 [, , 2000]. 128- , 240 .
, . . 7.3 .
7.3.
, | |
7 | ECHO - |
20 | FTP - File Transfer Protocol (Default Data) - |
21 | FTP - File Transfer Protocol (Control) - |
23 | TELNET - |
25 | SMTP - Simple Mail Transfer Protocol - |
53 | DNS - Domain Name Server - |
79 | FINGER - |
111 | RPC - Remote Procedure Call - |
115 | SFTP - Simple File Transfer Protocol - |
123 | NTP - Network Time Protocol - |
161 | SNMP- Simple Network Management Protocol- |
TCP/IP - TCP UDP (User Datagram Protocol).
UDP
UDP (. . , , UDP). IP. UDP . , TCP. UDP , DNS NTP.
TCP
TCP . , TELNET FTP.
TCP :
. TCP . " ". " ". , - , .
- .
, . - , ( ). - , , , . .
. , :
, . - .
- , , , .
- , . , , , .
.
, :
, , . . , :
. .
:
(Routing Information Protocol - RIP) . - . , , . , .
. , . , . , - , .
- ( ), - ( ).
, (count-to-infinity problem). , , . , 15 . .
:
, . - , . ., - "" , . . , - , .
(Open Shortest Path First Protocol - OSPF) . , :
. - , , .
IP-, . . . , . , . , - .
(Classless Inter-Domain Routing - CIDR) , [, , , 1999]. CIDR . , 1993 , .
, :
(Network Information Services - NIS) - . , . , :
, .
, , .
(Remove Procedure Call - RPC) , , , . , . . , - . [ 1997]:
. ( ). (, CORBA). , , . . , :
. . ISIS. Unix, . , ( ), . . 1- , i. , (. 7.12). P1 t1 . 2, P1 t2, t3. , 3 2 t4, . . , P1. , (1, 1, 0), (0, 0, 0). , . P1 t5, 3 t6.
. . , .
, , :
, .
. (L. Lamport) 1978 . , , . . , [Tanenbaum 1995].
() . " " - A->B , " ".
.
, , ->, -> , - . , :
->, C() < C().
ci pi : ci = ci + d, d > d = 1. m PI, tm = ci(a), PJ : cj = max(cj, tm+d). ci . .
- , , .
. , , .
()
, , . :
. . - , " ?" . , , . . , . , , , .
. . , . , .
, , . , . , , , , . , , .
.
, , . . .
-, , , :
"" , , .
- , . , , . , , , , . , . , .
:
.
[ 2000].
, . . . ENDJTRANSACTION ABORTJTRANSACTION. , , . - . .
. . :
, . - . , , :
' , , .
:
.
remote a.out - a.out. .
, , .
. - , , - , . . (L. Kleinrock) , T = 1/( - ). n . T' = 1/(yn - xn) = T/n. , , , .
. , . , . .
? :
.
.
, . , . .
, , [Tanenbaum 1995].
, . , .
- , ,
.
. 6.3.2. , .
. 7.13 .
.
- , . . , . , . . , .
, .
.
:
:
, . :
- , .
- .
- , , .
. , :
.
, .
, . .
().
, , . . , , .
, [, 1977].
, . 1986 . (. Li) - (Distributed Shared Memory - DSM). , .
, , . . , (trashing).
, , - (, ).
, , . 7.14 [Tanenbaum 1995].
[Tanenbaum 1995].
. , () .
()
, , , , , " - ". .
.
.
, .
- . :
, , :
:
- . .
- , . .
[Tanenbaum 1995].
- , , .
- , .
, . ( ), , .
.
, , .
:
: , , ', .
:
[Tanenbaum 1995].
, .
, .
1. , , 2000 - . ., . ., . . IPv6 - . // , 2, 2000.
2. 1986- . Unix. - .: , 1986.
3. 1990- . : , , .- .: , 1990.
4. 2000 - . . (6- .). - .; .; : "", 2000.
5. 1987 - . . - .: , 1987.
6. 1995 - . UNIX System V Release 4.2. - - , 1995.
7. 1998- . UNIX . 1, 2. - - , 1998.
8. , 1997- . ., . . . - .: -95, 1997.
9. 1985- . . - .: , 1985.
10. 1986- . . - .: , 1986.
11. 1975' - . . - .: , 1975.
12. 1999- . . .- .: "", 1999.
13. , 1998 - . ., . . .-: , 1998.
14. , , , 1999 - ., ., ., . UNIX: . - .: BHV - -, 1999.
15. 1997 - . . . - .: - , 1997.
16. , 2001 - . ., . . . - .: , 2001.
17. 1997 - . . UNIX. - .: BHV - -, 1997.
18. , 2001 - ., . Microsoft Windows 2000. -. - .: , .: - " ", 2001.
19. 1997- . TCP/IP. - .: BHV, 1997.
20. , 1977 - ., . . - .: , 1977.
21. Lewine 1995- Donald A. Lewine. POSIX Programmer's Guide. O'Reilly & Associates, Inc. 1995.
22. Lewis, Berg 1995 - Bil Lewis, Daniel J. Berg. A Guide to Multithreaded Programming. Threads Primer. SunSoft Press. A Prentice Hall Title. 1995.
23. Salus 1994 - Peter H. Salus. A Quarter Century of UNIX. Addison-Wesley Publishing. 1994.
24. Silberschatz, Galvin 1995 - Silberschatz A., Galvin P. Operating system concepts. Addison-Wesley Publishing. 1995.
25. Stevens 1994 - W. Richard Stevens. TCP/IP Illustrated: the protocols. Addison-Wesley Publishing. 1994.
26. Tanenbaum 1995 - Andrew S. Tanenbaum. Distributed operating system. Prentice-Hall, Inc. 1995.
10.11.2021 - 12:37: - Personalias -> WHO IS WHO - - _. 10.11.2021 - 12:36: - Conscience -> . ? - _. 10.11.2021 - 12:36: , , - Upbringing, Inlightening, Education -> ... - _. 10.11.2021 - 12:35: - Ecology -> - _. 10.11.2021 - 12:34: , - War, Politics and Science -> - _. 10.11.2021 - 12:34: , - War, Politics and Science -> . - _. 10.11.2021 - 12:34: , , - Upbringing, Inlightening, Education -> , - _. 10.11.2021 - 09:18: - New Technologies -> , 5G- - _. 10.11.2021 - 09:18: - Ecology -> - _. 10.11.2021 - 09:16: - Ecology -> - _. 10.11.2021 - 09:15: , , - Upbringing, Inlightening, Education -> - _. 10.11.2021 - 09:13: , , - Upbringing, Inlightening, Education -> - _. |