Linux¶àÏß³ÌÓëÐźÅ
LinuxϵÄÏß³ÌÊÇËùνµÄÇáÁ¿¼¶½ø³Ì£¨LWP: light weight process£©£¬ÆäÓëÆÕͨ½ø³ÌÒ»ÑùÓµÓÐÒ»¸öÅÓ´óµÄtask_struct½á¹¹Ì壬һ¸ö½ø³ÌÖеĶà¸öÏ̹߳²ÏíÄÚ´æ¿Õ¼ä£¬±Ï¾¹ËüÃÇÊôÓÚͬһ¸ö½ø³Ì£¬ËùÒÔÐèÒªÏòÍâ³ÊÏÖÒ»¸öͳһµÄpid£¬Òò´Ë¸÷Ï̵߳Äpid´æ·ÅµÄÊǽø³ÌºÅ£¬ÓÖÓÉÓÚÏß³ÌͬÑùÒ²Êǽø³Ì£¬Òò´ËÆäÓÐ×Ô¼ºµÄ½ø³ÌidºÅ£¬LinuxΪÁËÖ§³Ö¶àỊ̈߳¬ÓÚÊÇÌí¼ÓÁËÒ»¸ötid×Ö¶ÎÓÃÓÚ´æ·Å±¾Ï̵߳Ľø³ÌºÅ£¬Ïß³Ì×éµÄÖ÷Ïß³ÌpidͬtidÒ»Ö¡£getpidϵͳµ÷ÓÃÓÃÓÚ»ñÈ¡±¾½ø³ÌµÄ½ø³ÌºÅ£¬ÄÇÔõô»ñÈ¡±¾Ị̈߳¨ËùνµÄÇáÁ¿¼¶½ø³Ì£©µÄ½ø³ÌºÅÄØ£¿ÎÒ¸Õ´ÓÍøÉÏѧµ½ÁËÒ»¸ö¼¼ÇÉ£¬¾Ý˵ÊÇÓÉÓÚglibcûÓаü×°¸Ãϵͳµ÷Óã¬ËùÒÔÖ»ºÃ×Ô¼ºÊÖ¶¯Ê¹ÓÃsyscallÈ¥µ÷ÓÃÁË¡£gettidµÄϵͳµ÷Óúű£´æÔÚ”/usr/include/asm/unistd_32.h”Í·ÎļþÖУ¬´ò¿ª¸ÃÎļþ¿ÉÒÔ¿´µ½ÓÐÈçÏÂÄÚÈÝ£º
/* 223 is unused */
#define __NR_gettid 224
#define __NR_readahead 225
Òò´Ë¿ÉÒÔʹÓÃÈçÏ·½Ê½À´ÊµÏÖgettidº¯Êý£º
pid_t gettid()
{
//Ö±½ÓʹÓÃ224´úÌæSYS_gettidÒ²¿ÉÒÔ
return syscall(SYS_gettid);
}
ÏÂÃæÕâ¸ö³ÌÐò½ÏºÃµØÑÝʾÁ˶àÏ̻߳·¾³ÏÂʹÓÃÐźŵÄÌص㡣Ï̵߳ıêʶΪpthread_t£¬ËüÊÇÒ»¸ö½á¹¹Ì壬ֱ½Ó´òÓ¡»áÊÇÒ»¸öµØÖ·£¬Òò´Ë¿ÉÒÔʹÓÃÉÏÃæµÄgettidº¯ÊýÀ´»ñÈ¡±¾Ï̵߳Ľø³ÌºÅ¡£
?[Copy to clipboard]View Code CPP
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
/*
sleepº¯Êý£º
#include <unistd.h>
unsigned int sleep(unsigned int seconds);
´Ëº¯Êýʹµ÷Óýø³Ì±»¹ÒÆð£¬Ö±µ½Âú×ãÒÔÏÂÌõ¼þÖ®Ò»£º
1)ÒѾ¹ýÁËsecondsËùÖ¸¶¨µÄǽÉÏʱÖÓʱ¼ä
Ïà¹ØÎĵµ£º
Ò»¡¢Ðźż°ÐźÅÀ´Ô´
Ðźű¾ÖÊ
ÐźÅÊÇÔÚÈí¼þ²ã´ÎÉ϶ÔÖжϻúÖƵÄÒ»ÖÖÄ£Ä⣬ÔÚÔÀíÉÏ£¬Ò»¸ö½ø³ÌÊÕµ½Ò»¸öÐźÅÓë´¦ÀíÆ÷ÊÕµ½Ò»¸öÖжÏÇëÇó¿ÉÒÔ˵ÊÇÒ»ÑùµÄ¡£ÐźÅÊÇÒì²½µÄ£¬Ò»¸ö½ø³Ì²»±Øͨ¹ýÈκβÙ×÷À´µÈ´ýÐźŵĵ½´ï£¬ÊÂʵÉÏ£¬½ø³ÌÒ²²»ÖªµÀÐźŵ½µ×ʲôʱºòµ½´ï¡£
ÐźÅÊǽø³Ì¼äͨÐÅ»úÖÆÖÐΨһµÄÒ첽ͨÐÅ»úÖÆ£¬¿ÉÒÔ¿´×÷ÊÇÒì²½Í¨Ö ......
Ï̵߳Äͬ²½, ·¢ÉúÔÚ¶à¸öÏ̹߳²ÏíÏàͬÄÚ´æµÄʱºò, ÕâʱҪ±£Ö¤Ã¿¸öÏß³ÌÔÚÿ¸öʱ¿Ì¿´µ½µÄ¹²ÏíÊý¾ÝÊÇÒ»ÖµÄ. Èç¹ûÿ¸öÏß³ÌʹÓõıäÁ¿¶¼ÊÇÆäËûÏ̲߳»»áʹÓõÄ(read & write), »òÕß±äÁ¿ÊÇÖ»¶ÁµÄ, ¾Í²»´æÔÚÒ»ÖÂÐÔÎÊÌâ. µ«ÊÇ, Èç¹ûÁ½¸ö»òÁ½¸öÒÔÉϵÄÏ߳̿ÉÒÔread/writeÒ»¸ö±äÁ¿Ê±, ¾ÍÐèÒª¶ÔÏ߳̽øÐÐͬ²½, ÒÔÈ·±£ËüÃÇÔÚ·ÃÎʸñä ......
Linux³£ÓÃÃüÁîÇåµ¥
NO
·ÖÀà
PS1
ÃüÁîÃû
Ó÷¨¼°²ÎÊý
¹¦ÄÜ×¢½â
1
Îļþ¹ÜÀí
#
ls
ls -a
Áгöµ±Ç°Ä¿Â¼ÏµÄËùÓÐÎļþ£¬°üÀ¨ÒÔ.Í·µÄÒþº¬Îļþ
Îļþ¹ÜÀí
#
ls
ls -l»òll
Áгöµ±Ç°Ä¿Â¼ÏÂÎļþµÄÏêϸÐÅÏ¢
Îļþ¹ÜÀí
#
pwd
pwd
²é¿´µ±Ç°ËùÔÚĿ¼µÄ¾ø¶Ô·¾
  ......
ÃæÊÔʱһÔٵر»Îʵ½½ø³Ì¼äͨÐŵÄÇé¿ö£¬¶øÎÒµÄÀí½âһֱͣÁôÔÚ¸ÅÄîÉϺÍÃû´ÊÉÏ£¬±ØÐëÒª×öµãʵÑé¼ÓÉîÀí½â¡£
IPC:Interprocess communication¡£ÓÐЩIPCµÄ·½·¨²»½ö¿ÉÒÔÓÃÓÚÏàͬÖ÷»ú£¬Ò²¿ÉÒÔÓÃÓÚ²»Í¬Ö÷»ú£¬ÈçsocketsºÍSTREAMS¡£
¾µäIPCÖ®Ò»£ºpipes(¹ÜµÀ)
,ʹÓÃ×î¹ã·º£¬¾ßÓÐÇ×Ôµ¹Øϵ
µÄ½ø³Ì¼ä²ÅÄÜʹÓùܵÀ½øÐÐIPC¡£
ʹÓÃÁ˹ܵ ......
SLES10 Linux£¨kernel-2.6.16.21-0.8£©Æ½Ì¨Ï´Fortran²¢ÐбàÒë»·¾³
Ò»£®Fortran±àÒëÆ÷µÄ°²×°
Linux°²×°ÅÌÒ»°ã¶¼×Ô´øÓÐFortran±àÒëÆ÷£¬ÔÚSuSe9.1ÒÔÇ°¾ù´øÓÐg77£¬ÔÚSuse9.2ÒÔºóΪgfortran¡£µ«ÊÇ£¬Ïà¶ÔÀ´Ëµ£¬ÓÉÓÚg77ºÍgfortranµÄ±àÒëµÄ³ÌÐòÔËÐÐЧÂʲ»ÊǺܸߣ¬ËùÒÔ¶¼»áÑ¡ÔñÔÙ°²×°×¨ÒµµÄFortran±àÒëÆ÷¡£
Ö÷Á÷µÄFortran 90/ ......