SlideShare a Scribd company logo
8 A
1. 0 1., 2 1 2 1
/ 2/ , 5 44 201 8 /8/ /.
• ed 8
• R@ I
• a
• cg A @
• c c gd t l
• c efho t Rs
• t c gd = I
• t i a
• 81 . , 8 3 81 . . ., 82 t
• c xu t i a Rs A
• efho n
• i a c rv
.8 2.: , 33 2018 . . :.
• 02 8 I RA L R A
cd
• I
• a e
• I
0 2 11 0. 4 4 ,
• .: C I c il
• A 8: C 4 2 5A : C
• ,/1 .: 2 G il
• A 8 C 8 A 7 2 : 4 A 2 5
• aI Rnv otRghm I I fsL U
• I I Rbd r U
• .: C Rpue UN
0 : 2 4 :8 A A 5
•
• 0268A L
•
•
•
• R a
• I
•
0 2 11 0. ,
( 0 0 - 7. ) 2 0 0 0
• 18
• A
I
• A I
• 18
• 18 ,18 R
#include <stdio.h>
#include <unistd.h>
int main() {
pid_t pid = fork();
// forkA
if (pid == -1) {
printf("Fork failed¥n");
//
} else if (pid == 0) {
printf("Child process, pid: %d¥n",
getpid());
//
} else {
printf("Parent process, pid: %d¥n",
getpid());
}
}
$ gcc fork_sample.c && ./a.out
Parent process, pid: 72390
Child process, pid: 72391
0 A: 2 . 4# A:8 A A 5#
• , 8: #4 A 2 5 : (# A 7 A #4 / )
• 17 A RL15 17 A I
#ifdef __ARCH_WANT_SYS_FORK
SYSCALL_DEFINE0(fork)
{
#ifdef CONFIG_MMU
return _do_fork(SIGCHLD, 0, 0, NULL, NULL, 0);
#else
/* can not support in nommu mode */
return -EINVAL;
#endif
}
#endif
•
• 02 8A L
•
•
•
• R a
• I
•
9 0 2 11 0. ,
8 8 << 8 8 8
• .-0 8 GT
• I G.-0 O S
• NP
• AC1 8
• , .1
• ,.1 ,2 < GLR
). 1. ( , 1 0 8 .8. .
• 0 . , . .
I
• 0 . 2 1 I R A
#include <stdio.h>
#include <pthread.h>
void* print_doubled(void *x) {
int *ix = (int *)x;
printf("%d¥n", *ix * 2);
}
int main() {
pthread_t th;
int x = 100;
int ret = pthread_create(
&th, NULL, print_doubled, (void *)&x);
if (ret != 0) {
printf("thread execution failed");
return 255;
}
pthread_join(th, NULL);
return 0;
}
$ gcc -lpthread pthread_sample.c
$ ./a.out
200
( (
# 2 : 2 / 70 66 : :2 2: 21
• 7 6 :2/1.0:2/ 2 0 , #
• R
• 72 :2/1 I 1
• / : :2/1. :2/1./ :
• /: .:8 72 I A LR
• /: /: .:8 72 R
int
__pthread_create_2_1 (pthread_t *newthread, const pthread_attr_t *attr,
void *(*start_routine) (void *), void *arg)
( (
2 , ) (33 201 8 8 .
• 1 ,. 8 , 2 , 0 A
• , 1 ,. 1 ,.
int
__pthread_create_2_1 (pthread_t *newthread, const pthread_attr_t *attr,
void *(*start_routine) (void *), void *arg)
{
const struct pthread_attr *iattr = (struct pthread_attr *) attr;
struct pthread *pd = NULL;
int err = ALLOCATE_STACK(iattr, &pd);
/* */
pd->start_routine = start_routine;
pd->arg = arg;
/* */
*newthread = (pthread_t) pd;
/* */
int retval = create_thread(pd, iattr, ...);
return retval;
}
8 8 / # A 8A8 87# (
• A A78 A C E A A CE 8 8 8 7# 0()
• ,.4,021 A A4 8 R HN O IL
static int
create_thread (struct pthread *pd, const struct pthread_attr *attr,
bool *stopped_start, STACK_VARIABLES_PARMS, bool *thread_ran)
{
/* */
const int clone_flags = (CLONE_VM | CLONE_FS | CLONE_FILES | CLONE_SYSVSEM
| CLONE_SIGHAND | CLONE_THREAD
| CLONE_SETTLS | CLONE_PARENT_SETTID
| CLONE_CHILD_CLEARTID
| 0);
/* */
ARCH_CLONE(&start_thread, STACK_VARIABLES_PARMS, clone_flags, pd, &pd->tid, tp,
&pd->tid);
/* */
return 0;
}
0 A: 2 . 4# A:8 A A 5# )
• , 8: #4 A 2 5 : (# A 7 A #4 /
• 14 15 17 A L I
SYSCALL_DEFINE5(clone, unsigned long, clone_flags, unsigned long, newsp,
int __user *, parent_tidptr,
int __user *, child_tidptr,
unsigned long, tls)
{
return _do_fork(clone_flags, newsp, 0, parent_tidptr, child_tidptr, tls);
}
) ) (
I GEA H: 0C EA GF E F EH
• N LM _ O DC > : FO
• TV 60. 1
• RS 1 , 82 1 , -6 1 , -01,6 1 , ,
M I : /D IH H
• IIFH D LAC EH D AF IC 0 C:D F: H C:D ED IC
• 0 2, 81
• Rx mtedV mted Sop u
• 0 2, -
• Rx mtedV mtedP S rcdhn v T
• 0 2, -/0,
• Rx mtedV mted ri_da m hNlr v T
• 0 2, 7. ,
• mted Rx mtedV Sdsgj rNm O
# . / , 1 77 45 2
/*
* cloning flags:
*/
#define CSIGNAL 0x000000ff /* signal mask to be sent at exit */
#define CLONE_VM 0x00000100 /* set if VM shared between processes */
#define CLONE_FS 0x00000200 /* set if fs info shared between processes */
#define CLONE_FILES 0x00000400 /* set if open files shared between processes */
#define CLONE_SIGHAND 0x00000800 /* set if signal handlers and blocked signals shared */
/* */
#define CLONE_NEWPID 0x20000000 /* New pid namespace */
#define CLONE_NEWNET 0x40000000 /* New network namespace */
#define CLONE_IO 0x80000000 /* Clone io context */
• 5 4 5 0 1:8 : /72 7 A 07:0 17 2 / 7 A 15 2 5
• L 0
• I 0 4 /7
8 , ) ( 8 12 9 8 9 8 .
• _ Ied 0 8 R A
• Ied R A
• I R . 0 8
• ed fcI ag
•
• 1 R L
• I R
•
• IA
•
8 , 2 , 1 00 2 . 2, ,2 ,
# . A 7 / , 1 75 A 2
• AA 57A 0 1 : A / 2 7 0 0 8 4 8 1 #
• R I L
long _do_fork(unsigned long clone_flags,
unsigned long stack_start,
unsigned long stack_size,
int __user *parent_tidptr,
int __user *child_tidptr,
unsigned long tls)
# /5A 85 1 ,:: 8 7A 5 5 54
• 7AA 8A7 2 A 1:4 :8 2: 2 8 : 45 :8 754 7 .
• A1 90 A A aI b
• _ R L
struct task_struct {
struct thread_info thread_info;
volatile long state;
void *stack;
struct mm_struct *mm;
struct mm_struct *active_mm;
pid_t pid;
pid_t tgid;
/* Filesystem information */
struct fs_struct *fs;
/* Open file information */
struct files_struct *files;
/* c */
}
2 , ) ( 201 .
• I
A I
• ,3 , 3 I
R A 8
long _do_fork(unsigned long clone_flags,
unsigned long stack_start,
unsigned long stack_size,
int __user *parent_tidptr,
int __user *child_tidptr,
unsigned long tls)
{
struct task_struct *p;
/* */
p = copy_process(
clone_flags, stack_start, stack_size,
child_tidptr, NULL, trace, tls, NUMA_NO_NODE);
/* */
struct pid *pid = get_task_pid(p, PIDTYPE_PID);
long nr = pid_vnr(pid);
wake_up_new_task(p);
/* */
return nr;
}
0 A: 2 . 4# A:8 A A 5# (
• , 8: #4 A 2 5 :
(# A 7 A #4 / )
• 5 1 2 1 A 4
• m Rb hf o I
di a kr
• 4 1
• p Rh_ m
e
• nl e g c L
static struct task_struct *copy_process(
unsigned long clone_flags,
unsigned long stack_start,
unsigned long stack_size,
int __user *child_tidptr, ...)
{
struct task_struct *p; int retval;
/* s */
p = dup_task_struct(current, node);
/* s */
retval = copy_fs(clone_flags, p);
if (retval)
goto bad_fork_cleanup_files;
retval = copy_mm(clone_flags, p);
if (retval)
goto bad_fork_cleanup_signal;
/* s */
return p;
}
N # 4 I 8 . : I
• II I :EC IE 8 L E
A E A : /
• :E M7CCt mnpus diP
U R
• : I vx, 5
I8 A7 I :I ah e lbr
• e gh ,/21 7 0 oc
y V_ diPV_ Ok
rfe ,/21 7 0 oc y
V_ diP
static int copy_mm(unsigned long clone_flags,
struct task_struct *tsk)
{
struct mm_struct *mm, *oldmm;
/* */
oldmm = current->mm;
/* */
if (clone_flags & CLONE_VM) {
mmget(oldmm);
mm = oldmm;
goto good_mm;
}
mm = dup_mm(tsk);
good_mm:
tsk->mm = mm;
tsk->active_mm = mm;
return 0;
/* */
}
0 22 0. 6 6 ,
• A 61 6 8 a
• _ 2 R I A c
• d A
•
• 02 8A R
•
• R
• L I
•
0 7 2 11 0. 7 ,
• l Sd O l
• Sd O ah
• = i c I Ie n R ad
A
• ISd O g
8 . 1. , 22 1 0 . . .
( ( ) (
I , 28 8 4 0 # / 9: 8 8 87#
• : A . 9 : 5# 4 7
5 5 )# 8 8 :87 8#
1 ,(
• :3 abed
g RL :3
_ c
g R
static __always_inline struct rq *
context_switch(struct rq *rq,
struct task_struct *prev,
struct task_struct *next, /* h */)
{
struct mm_struct *mm, *oldmm;
mm = next->mm;
old_mm = prev->active_mm;
/* h */
if (!mm) {
/* h */
} else
switch_mm_irqs_off(oldmm, mm, next);
/* h */
switch_to(prev, next, prev);
barrier();
return finish_task_switch(prev);
}
) ( )
# /4 74A0 :2 ,88 7 6 4 4 A43 #
• 6 7 6 1 2 A083 87: 18 1 A 0 26 81 2 .
• R I L
void switch_mm_irqs_off(struct mm_struct * prev, struct mm_struct *next,
struct task_struct *tsk)
{
struct mm_struct *real_prev = this_cpu_read(cpu_tlbstate.loaded_mm);
if (real_prev == next) {
/* */
return;
} else {
/* */
}
/* */
}
8 . 1. 3, 22 1 0 . . .
• i a d R c
• a ge l nA I Sc
O h
• a
• 02 8 L R
• I
• R I
• R c
•
• A
30 2 11 30. 3 3 ,
0 0 ) . ( 23 0 0 0
• go 18 h A I nad . 8 0 h A I
R , . v I , 8,18
R
• nad x . 8 0fk l_A go s R
• nad i ltr s R c a go
L
• 18 u Ae I L i
/4A 74 0 - 2 ,:: 7 A 4 4 43
• da.7 g l
• .7 R bmLjihc
• AA 71 2 34 4: 4 9 8 :7 :71 0 : :7 24
0 0 4 4 A 7 34 A :
• .7
• AA 797 17A 7 4 2 :7 94 4: 4
• L e kI
• AA 3 0A4 0 4 8 0 0
1. 0 1., 2 1 2 1

More Related Content

What's hot

Magnum IO GPUDirect Storage 最新情報
Magnum IO GPUDirect Storage 最新情報Magnum IO GPUDirect Storage 最新情報
Magnum IO GPUDirect Storage 最新情報
NVIDIA Japan
 
DBスキーマもバージョン管理したい!
DBスキーマもバージョン管理したい!DBスキーマもバージョン管理したい!
DBスキーマもバージョン管理したい!
kwatch
 
Kubernetesによる機械学習基盤への挑戦
Kubernetesによる機械学習基盤への挑戦Kubernetesによる機械学習基盤への挑戦
Kubernetesによる機械学習基盤への挑戦
Preferred Networks
 
containerdの概要と最近の機能
containerdの概要と最近の機能containerdの概要と最近の機能
containerdの概要と最近の機能
Kohei Tokunaga
 
Hadoop -NameNode HAの仕組み-
Hadoop -NameNode HAの仕組み-Hadoop -NameNode HAの仕組み-
Hadoop -NameNode HAの仕組み-
Yuki Gonda
 
REST API に疲れたあなたへ贈る GraphQL 入門
REST API に疲れたあなたへ贈る GraphQL 入門REST API に疲れたあなたへ贈る GraphQL 入門
REST API に疲れたあなたへ贈る GraphQL 入門
Keisuke Tsukagoshi
 
CloudNativePGを動かしてみた! ~PostgreSQL on Kubernetes~(第34回PostgreSQLアンカンファレンス@オンライ...
CloudNativePGを動かしてみた! ~PostgreSQL on Kubernetes~(第34回PostgreSQLアンカンファレンス@オンライ...CloudNativePGを動かしてみた! ~PostgreSQL on Kubernetes~(第34回PostgreSQLアンカンファレンス@オンライ...
CloudNativePGを動かしてみた! ~PostgreSQL on Kubernetes~(第34回PostgreSQLアンカンファレンス@オンライ...
NTT DATA Technology & Innovation
 
OSTree: OSイメージとパッケージシステムの間にGitのアプローチを
OSTree: OSイメージとパッケージシステムの間にGitのアプローチをOSTree: OSイメージとパッケージシステムの間にGitのアプローチを
OSTree: OSイメージとパッケージシステムの間にGitのアプローチを
i_yudai
 
A100 GPU 搭載! P4d インスタンス 使いこなしのコツ
A100 GPU 搭載! P4d インスタンス使いこなしのコツA100 GPU 搭載! P4d インスタンス使いこなしのコツ
A100 GPU 搭載! P4d インスタンス 使いこなしのコツ
Kuninobu SaSaki
 
MongoDBが遅いときの切り分け方法
MongoDBが遅いときの切り分け方法MongoDBが遅いときの切り分け方法
MongoDBが遅いときの切り分け方法
Tetsutaro Watanabe
 
perfを使ったPostgreSQLの解析(後編)
perfを使ったPostgreSQLの解析(後編)perfを使ったPostgreSQLの解析(後編)
perfを使ったPostgreSQLの解析(後編)
NTT DATA OSS Professional Services
 
プログラムを高速化する話Ⅱ 〜GPGPU編〜
プログラムを高速化する話Ⅱ 〜GPGPU編〜プログラムを高速化する話Ⅱ 〜GPGPU編〜
プログラムを高速化する話Ⅱ 〜GPGPU編〜
京大 マイコンクラブ
 
pg_bigmで全文検索するときに気を付けたい5つのポイント(第23回PostgreSQLアンカンファレンス@オンライン 発表資料)
pg_bigmで全文検索するときに気を付けたい5つのポイント(第23回PostgreSQLアンカンファレンス@オンライン 発表資料)pg_bigmで全文検索するときに気を付けたい5つのポイント(第23回PostgreSQLアンカンファレンス@オンライン 発表資料)
pg_bigmで全文検索するときに気を付けたい5つのポイント(第23回PostgreSQLアンカンファレンス@オンライン 発表資料)
NTT DATA Technology & Innovation
 
Javaコードが速く実⾏される秘密 - JITコンパイラ⼊⾨(JJUG CCC 2020 Fall講演資料)
Javaコードが速く実⾏される秘密 - JITコンパイラ⼊⾨(JJUG CCC 2020 Fall講演資料)Javaコードが速く実⾏される秘密 - JITコンパイラ⼊⾨(JJUG CCC 2020 Fall講演資料)
Javaコードが速く実⾏される秘密 - JITコンパイラ⼊⾨(JJUG CCC 2020 Fall講演資料)
NTT DATA Technology & Innovation
 
コンテナ未経験新人が学ぶコンテナ技術入門
コンテナ未経験新人が学ぶコンテナ技術入門コンテナ未経験新人が学ぶコンテナ技術入門
コンテナ未経験新人が学ぶコンテナ技術入門
Kohei Tokunaga
 
unique_ptrにポインタ以外のものを持たせるとき
unique_ptrにポインタ以外のものを持たせるときunique_ptrにポインタ以外のものを持たせるとき
unique_ptrにポインタ以外のものを持たせるとき
Shintarou Okada
 
12 分くらいで知るLuaVM
12 分くらいで知るLuaVM12 分くらいで知るLuaVM
12 分くらいで知るLuaVM
Yuki Tamura
 
CUDAのアセンブリ言語基礎のまとめ PTXとSASSの概説
CUDAのアセンブリ言語基礎のまとめ PTXとSASSの概説CUDAのアセンブリ言語基礎のまとめ PTXとSASSの概説
CUDAのアセンブリ言語基礎のまとめ PTXとSASSの概説
Takateru Yamagishi
 
Unified JVM Logging
Unified JVM LoggingUnified JVM Logging
Unified JVM Logging
Yuji Kubota
 
今話題のいろいろなコンテナランタイムを比較してみた
今話題のいろいろなコンテナランタイムを比較してみた今話題のいろいろなコンテナランタイムを比較してみた
今話題のいろいろなコンテナランタイムを比較してみた
Kohei Tokunaga
 

What's hot (20)

Magnum IO GPUDirect Storage 最新情報
Magnum IO GPUDirect Storage 最新情報Magnum IO GPUDirect Storage 最新情報
Magnum IO GPUDirect Storage 最新情報
 
DBスキーマもバージョン管理したい!
DBスキーマもバージョン管理したい!DBスキーマもバージョン管理したい!
DBスキーマもバージョン管理したい!
 
Kubernetesによる機械学習基盤への挑戦
Kubernetesによる機械学習基盤への挑戦Kubernetesによる機械学習基盤への挑戦
Kubernetesによる機械学習基盤への挑戦
 
containerdの概要と最近の機能
containerdの概要と最近の機能containerdの概要と最近の機能
containerdの概要と最近の機能
 
Hadoop -NameNode HAの仕組み-
Hadoop -NameNode HAの仕組み-Hadoop -NameNode HAの仕組み-
Hadoop -NameNode HAの仕組み-
 
REST API に疲れたあなたへ贈る GraphQL 入門
REST API に疲れたあなたへ贈る GraphQL 入門REST API に疲れたあなたへ贈る GraphQL 入門
REST API に疲れたあなたへ贈る GraphQL 入門
 
CloudNativePGを動かしてみた! ~PostgreSQL on Kubernetes~(第34回PostgreSQLアンカンファレンス@オンライ...
CloudNativePGを動かしてみた! ~PostgreSQL on Kubernetes~(第34回PostgreSQLアンカンファレンス@オンライ...CloudNativePGを動かしてみた! ~PostgreSQL on Kubernetes~(第34回PostgreSQLアンカンファレンス@オンライ...
CloudNativePGを動かしてみた! ~PostgreSQL on Kubernetes~(第34回PostgreSQLアンカンファレンス@オンライ...
 
OSTree: OSイメージとパッケージシステムの間にGitのアプローチを
OSTree: OSイメージとパッケージシステムの間にGitのアプローチをOSTree: OSイメージとパッケージシステムの間にGitのアプローチを
OSTree: OSイメージとパッケージシステムの間にGitのアプローチを
 
A100 GPU 搭載! P4d インスタンス 使いこなしのコツ
A100 GPU 搭載! P4d インスタンス使いこなしのコツA100 GPU 搭載! P4d インスタンス使いこなしのコツ
A100 GPU 搭載! P4d インスタンス 使いこなしのコツ
 
MongoDBが遅いときの切り分け方法
MongoDBが遅いときの切り分け方法MongoDBが遅いときの切り分け方法
MongoDBが遅いときの切り分け方法
 
perfを使ったPostgreSQLの解析(後編)
perfを使ったPostgreSQLの解析(後編)perfを使ったPostgreSQLの解析(後編)
perfを使ったPostgreSQLの解析(後編)
 
プログラムを高速化する話Ⅱ 〜GPGPU編〜
プログラムを高速化する話Ⅱ 〜GPGPU編〜プログラムを高速化する話Ⅱ 〜GPGPU編〜
プログラムを高速化する話Ⅱ 〜GPGPU編〜
 
pg_bigmで全文検索するときに気を付けたい5つのポイント(第23回PostgreSQLアンカンファレンス@オンライン 発表資料)
pg_bigmで全文検索するときに気を付けたい5つのポイント(第23回PostgreSQLアンカンファレンス@オンライン 発表資料)pg_bigmで全文検索するときに気を付けたい5つのポイント(第23回PostgreSQLアンカンファレンス@オンライン 発表資料)
pg_bigmで全文検索するときに気を付けたい5つのポイント(第23回PostgreSQLアンカンファレンス@オンライン 発表資料)
 
Javaコードが速く実⾏される秘密 - JITコンパイラ⼊⾨(JJUG CCC 2020 Fall講演資料)
Javaコードが速く実⾏される秘密 - JITコンパイラ⼊⾨(JJUG CCC 2020 Fall講演資料)Javaコードが速く実⾏される秘密 - JITコンパイラ⼊⾨(JJUG CCC 2020 Fall講演資料)
Javaコードが速く実⾏される秘密 - JITコンパイラ⼊⾨(JJUG CCC 2020 Fall講演資料)
 
コンテナ未経験新人が学ぶコンテナ技術入門
コンテナ未経験新人が学ぶコンテナ技術入門コンテナ未経験新人が学ぶコンテナ技術入門
コンテナ未経験新人が学ぶコンテナ技術入門
 
unique_ptrにポインタ以外のものを持たせるとき
unique_ptrにポインタ以外のものを持たせるときunique_ptrにポインタ以外のものを持たせるとき
unique_ptrにポインタ以外のものを持たせるとき
 
12 分くらいで知るLuaVM
12 分くらいで知るLuaVM12 分くらいで知るLuaVM
12 分くらいで知るLuaVM
 
CUDAのアセンブリ言語基礎のまとめ PTXとSASSの概説
CUDAのアセンブリ言語基礎のまとめ PTXとSASSの概説CUDAのアセンブリ言語基礎のまとめ PTXとSASSの概説
CUDAのアセンブリ言語基礎のまとめ PTXとSASSの概説
 
Unified JVM Logging
Unified JVM LoggingUnified JVM Logging
Unified JVM Logging
 
今話題のいろいろなコンテナランタイムを比較してみた
今話題のいろいろなコンテナランタイムを比較してみた今話題のいろいろなコンテナランタイムを比較してみた
今話題のいろいろなコンテナランタイムを比較してみた
 

Similar to Linuxカーネルを読んで改めて知るプロセスとスレッドの違い

The Ring programming language version 1.5.3 book - Part 97 of 184
The Ring programming language version 1.5.3 book - Part 97 of 184The Ring programming language version 1.5.3 book - Part 97 of 184
The Ring programming language version 1.5.3 book - Part 97 of 184
Mahmoud Samir Fayed
 
Lab 2 Histrogram generation Author Naga Kandasamy .docx
 Lab 2 Histrogram generation   Author Naga Kandasamy  .docx Lab 2 Histrogram generation   Author Naga Kandasamy  .docx
Lab 2 Histrogram generation Author Naga Kandasamy .docx
aryan532920
 
Unit 4
Unit 4Unit 4
Unit 4
siddr
 
TensorFlow 2: New Era of Developing Deep Learning Models
TensorFlow 2: New Era of Developing Deep Learning ModelsTensorFlow 2: New Era of Developing Deep Learning Models
TensorFlow 2: New Era of Developing Deep Learning Models
Jeongkyu Shin
 
Argoによる機械学習実行基盤の構築・運用からみえてきたこと
Argoによる機械学習実行基盤の構築・運用からみえてきたことArgoによる機械学習実行基盤の構築・運用からみえてきたこと
Argoによる機械学習実行基盤の構築・運用からみえてきたこと
Shinsaku Kono
 
LSFMM 2019 BPF Observability
LSFMM 2019 BPF ObservabilityLSFMM 2019 BPF Observability
LSFMM 2019 BPF Observability
Brendan Gregg
 
Google Polymer in Action
Google Polymer in ActionGoogle Polymer in Action
Google Polymer in Action
Jeongkyu Shin
 
ROS2勉強会@別府 第7章Pythonクライアントライブラリrclpy
ROS2勉強会@別府 第7章PythonクライアントライブラリrclpyROS2勉強会@別府 第7章Pythonクライアントライブラリrclpy
ROS2勉強会@別府 第7章Pythonクライアントライブラリrclpy
Atsuki Yokota
 
Code GPU with CUDA - Identifying performance limiters
Code GPU with CUDA - Identifying performance limitersCode GPU with CUDA - Identifying performance limiters
Code GPU with CUDA - Identifying performance limiters
Marina Kolpakova
 
Crash_Report_Mechanism_In_Tizen
Crash_Report_Mechanism_In_TizenCrash_Report_Mechanism_In_Tizen
Crash_Report_Mechanism_In_Tizen
Lex Yu
 
Rust: код может быть одновременно безопасным и быстрым, Степан Кольцов
Rust: код может быть одновременно безопасным и быстрым, Степан КольцовRust: код может быть одновременно безопасным и быстрым, Степан Кольцов
Rust: код может быть одновременно безопасным и быстрым, Степан Кольцов
Yandex
 
The Ring programming language version 1.2 book - Part 61 of 84
The Ring programming language version 1.2 book - Part 61 of 84The Ring programming language version 1.2 book - Part 61 of 84
The Ring programming language version 1.2 book - Part 61 of 84
Mahmoud Samir Fayed
 
Getting started cpp full
Getting started cpp   fullGetting started cpp   full
Getting started cpp full
Võ Hòa
 
The Ring programming language version 1.3 book - Part 67 of 88
The Ring programming language version 1.3 book - Part 67 of 88The Ring programming language version 1.3 book - Part 67 of 88
The Ring programming language version 1.3 book - Part 67 of 88
Mahmoud Samir Fayed
 
The Ring programming language version 1.7 book - Part 87 of 196
The Ring programming language version 1.7 book - Part 87 of 196The Ring programming language version 1.7 book - Part 87 of 196
The Ring programming language version 1.7 book - Part 87 of 196
Mahmoud Samir Fayed
 
Erlang Introduction Bcberlin3
Erlang Introduction Bcberlin3Erlang Introduction Bcberlin3
Erlang Introduction Bcberlin3
guesta3202
 
Hacking Parse.y with ujihisa
Hacking Parse.y with ujihisaHacking Parse.y with ujihisa
Hacking Parse.y with ujihisa
ujihisa
 
AIアプリはこう作る!-独自の識別モデル作成も簡単 Einstein Platform Services の使い方
AIアプリはこう作る!-独自の識別モデル作成も簡単 Einstein Platform Services の使い方AIアプリはこう作る!-独自の識別モデル作成も簡単 Einstein Platform Services の使い方
AIアプリはこう作る!-独自の識別モデル作成も簡単 Einstein Platform Services の使い方
Salesforce Developers Japan
 
proxyc CSAPP Web proxy NAME IMPORTANT Giv.pdf
  proxyc  CSAPP Web proxy   NAME    IMPORTANT Giv.pdf  proxyc  CSAPP Web proxy   NAME    IMPORTANT Giv.pdf
proxyc CSAPP Web proxy NAME IMPORTANT Giv.pdf
ajay1317
 
php[world] 2016 - You Don’t Need Node.js - Async Programming in PHP
php[world] 2016 - You Don’t Need Node.js - Async Programming in PHPphp[world] 2016 - You Don’t Need Node.js - Async Programming in PHP
php[world] 2016 - You Don’t Need Node.js - Async Programming in PHP
Adam Englander
 

Similar to Linuxカーネルを読んで改めて知るプロセスとスレッドの違い (20)

The Ring programming language version 1.5.3 book - Part 97 of 184
The Ring programming language version 1.5.3 book - Part 97 of 184The Ring programming language version 1.5.3 book - Part 97 of 184
The Ring programming language version 1.5.3 book - Part 97 of 184
 
Lab 2 Histrogram generation Author Naga Kandasamy .docx
 Lab 2 Histrogram generation   Author Naga Kandasamy  .docx Lab 2 Histrogram generation   Author Naga Kandasamy  .docx
Lab 2 Histrogram generation Author Naga Kandasamy .docx
 
Unit 4
Unit 4Unit 4
Unit 4
 
TensorFlow 2: New Era of Developing Deep Learning Models
TensorFlow 2: New Era of Developing Deep Learning ModelsTensorFlow 2: New Era of Developing Deep Learning Models
TensorFlow 2: New Era of Developing Deep Learning Models
 
Argoによる機械学習実行基盤の構築・運用からみえてきたこと
Argoによる機械学習実行基盤の構築・運用からみえてきたことArgoによる機械学習実行基盤の構築・運用からみえてきたこと
Argoによる機械学習実行基盤の構築・運用からみえてきたこと
 
LSFMM 2019 BPF Observability
LSFMM 2019 BPF ObservabilityLSFMM 2019 BPF Observability
LSFMM 2019 BPF Observability
 
Google Polymer in Action
Google Polymer in ActionGoogle Polymer in Action
Google Polymer in Action
 
ROS2勉強会@別府 第7章Pythonクライアントライブラリrclpy
ROS2勉強会@別府 第7章PythonクライアントライブラリrclpyROS2勉強会@別府 第7章Pythonクライアントライブラリrclpy
ROS2勉強会@別府 第7章Pythonクライアントライブラリrclpy
 
Code GPU with CUDA - Identifying performance limiters
Code GPU with CUDA - Identifying performance limitersCode GPU with CUDA - Identifying performance limiters
Code GPU with CUDA - Identifying performance limiters
 
Crash_Report_Mechanism_In_Tizen
Crash_Report_Mechanism_In_TizenCrash_Report_Mechanism_In_Tizen
Crash_Report_Mechanism_In_Tizen
 
Rust: код может быть одновременно безопасным и быстрым, Степан Кольцов
Rust: код может быть одновременно безопасным и быстрым, Степан КольцовRust: код может быть одновременно безопасным и быстрым, Степан Кольцов
Rust: код может быть одновременно безопасным и быстрым, Степан Кольцов
 
The Ring programming language version 1.2 book - Part 61 of 84
The Ring programming language version 1.2 book - Part 61 of 84The Ring programming language version 1.2 book - Part 61 of 84
The Ring programming language version 1.2 book - Part 61 of 84
 
Getting started cpp full
Getting started cpp   fullGetting started cpp   full
Getting started cpp full
 
The Ring programming language version 1.3 book - Part 67 of 88
The Ring programming language version 1.3 book - Part 67 of 88The Ring programming language version 1.3 book - Part 67 of 88
The Ring programming language version 1.3 book - Part 67 of 88
 
The Ring programming language version 1.7 book - Part 87 of 196
The Ring programming language version 1.7 book - Part 87 of 196The Ring programming language version 1.7 book - Part 87 of 196
The Ring programming language version 1.7 book - Part 87 of 196
 
Erlang Introduction Bcberlin3
Erlang Introduction Bcberlin3Erlang Introduction Bcberlin3
Erlang Introduction Bcberlin3
 
Hacking Parse.y with ujihisa
Hacking Parse.y with ujihisaHacking Parse.y with ujihisa
Hacking Parse.y with ujihisa
 
AIアプリはこう作る!-独自の識別モデル作成も簡単 Einstein Platform Services の使い方
AIアプリはこう作る!-独自の識別モデル作成も簡単 Einstein Platform Services の使い方AIアプリはこう作る!-独自の識別モデル作成も簡単 Einstein Platform Services の使い方
AIアプリはこう作る!-独自の識別モデル作成も簡単 Einstein Platform Services の使い方
 
proxyc CSAPP Web proxy NAME IMPORTANT Giv.pdf
  proxyc  CSAPP Web proxy   NAME    IMPORTANT Giv.pdf  proxyc  CSAPP Web proxy   NAME    IMPORTANT Giv.pdf
proxyc CSAPP Web proxy NAME IMPORTANT Giv.pdf
 
php[world] 2016 - You Don’t Need Node.js - Async Programming in PHP
php[world] 2016 - You Don’t Need Node.js - Async Programming in PHPphp[world] 2016 - You Don’t Need Node.js - Async Programming in PHP
php[world] 2016 - You Don’t Need Node.js - Async Programming in PHP
 

More from Retrieva inc.

コンテナ仮想、その裏側 〜user namespaceとrootlessコンテナ〜
コンテナ仮想、その裏側 〜user namespaceとrootlessコンテナ〜コンテナ仮想、その裏側 〜user namespaceとrootlessコンテナ〜
コンテナ仮想、その裏側 〜user namespaceとrootlessコンテナ〜
Retrieva inc.
 
音声認識入門(前編)
音声認識入門(前編)音声認識入門(前編)
音声認識入門(前編)
Retrieva inc.
 
自然言語処理シリーズ9 構文解析 3.6-3.8節
自然言語処理シリーズ9 構文解析 3.6-3.8節自然言語処理シリーズ9 構文解析 3.6-3.8節
自然言語処理シリーズ9 構文解析 3.6-3.8節
Retrieva inc.
 
IP電話交換機ソフト Asterisk について
IP電話交換機ソフト Asterisk についてIP電話交換機ソフト Asterisk について
IP電話交換機ソフト Asterisk について
Retrieva inc.
 
論理的思考で読解力を培う
論理的思考で読解力を培う論理的思考で読解力を培う
論理的思考で読解力を培う
Retrieva inc.
 
キートップのノベルティを作ってみた話
キートップのノベルティを作ってみた話キートップのノベルティを作ってみた話
キートップのノベルティを作ってみた話
Retrieva inc.
 
自然言語処理勉強会11章 情報抽出と知識獲得
自然言語処理勉強会11章 情報抽出と知識獲得自然言語処理勉強会11章 情報抽出と知識獲得
自然言語処理勉強会11章 情報抽出と知識獲得
Retrieva inc.
 
キートップのノベルティを作った話
キートップのノベルティを作った話キートップのノベルティを作った話
キートップのノベルティを作った話
Retrieva inc.
 
放送大学テキスト「自然言語処理」 6章 意味の解析(1)
放送大学テキスト「自然言語処理」 6章 意味の解析(1)放送大学テキスト「自然言語処理」 6章 意味の解析(1)
放送大学テキスト「自然言語処理」 6章 意味の解析(1)
Retrieva inc.
 
キーボード自作のススメ
キーボード自作のススメキーボード自作のススメ
キーボード自作のススメ
Retrieva inc.
 
レトリバのキートップ説明書
レトリバのキートップ説明書レトリバのキートップ説明書
レトリバのキートップ説明書
Retrieva inc.
 
ブースティング入門
ブースティング入門ブースティング入門
ブースティング入門
Retrieva inc.
 
情報検索の基礎
情報検索の基礎情報検索の基礎
情報検索の基礎
Retrieva inc.
 
Chainer の Trainer 解説と NStepLSTM について
Chainer の Trainer 解説と NStepLSTM についてChainer の Trainer 解説と NStepLSTM について
Chainer の Trainer 解説と NStepLSTM について
Retrieva inc.
 
ChainerでDeep Learningを試すために必要なこと
ChainerでDeep Learningを試すために必要なことChainerでDeep Learningを試すために必要なこと
ChainerでDeep Learningを試すために必要なこと
Retrieva inc.
 
20170221 cnet live講演資料
20170221 cnet live講演資料20170221 cnet live講演資料
20170221 cnet live講演資料
Retrieva inc.
 
Making Google Cardboard and Laser Cutter
Making Google Cardboard and Laser CutterMaking Google Cardboard and Laser Cutter
Making Google Cardboard and Laser Cutter
Retrieva inc.
 
Chainerで学ぶdeep learning
Chainerで学ぶdeep learningChainerで学ぶdeep learning
Chainerで学ぶdeep learning
Retrieva inc.
 

More from Retrieva inc. (18)

コンテナ仮想、その裏側 〜user namespaceとrootlessコンテナ〜
コンテナ仮想、その裏側 〜user namespaceとrootlessコンテナ〜コンテナ仮想、その裏側 〜user namespaceとrootlessコンテナ〜
コンテナ仮想、その裏側 〜user namespaceとrootlessコンテナ〜
 
音声認識入門(前編)
音声認識入門(前編)音声認識入門(前編)
音声認識入門(前編)
 
自然言語処理シリーズ9 構文解析 3.6-3.8節
自然言語処理シリーズ9 構文解析 3.6-3.8節自然言語処理シリーズ9 構文解析 3.6-3.8節
自然言語処理シリーズ9 構文解析 3.6-3.8節
 
IP電話交換機ソフト Asterisk について
IP電話交換機ソフト Asterisk についてIP電話交換機ソフト Asterisk について
IP電話交換機ソフト Asterisk について
 
論理的思考で読解力を培う
論理的思考で読解力を培う論理的思考で読解力を培う
論理的思考で読解力を培う
 
キートップのノベルティを作ってみた話
キートップのノベルティを作ってみた話キートップのノベルティを作ってみた話
キートップのノベルティを作ってみた話
 
自然言語処理勉強会11章 情報抽出と知識獲得
自然言語処理勉強会11章 情報抽出と知識獲得自然言語処理勉強会11章 情報抽出と知識獲得
自然言語処理勉強会11章 情報抽出と知識獲得
 
キートップのノベルティを作った話
キートップのノベルティを作った話キートップのノベルティを作った話
キートップのノベルティを作った話
 
放送大学テキスト「自然言語処理」 6章 意味の解析(1)
放送大学テキスト「自然言語処理」 6章 意味の解析(1)放送大学テキスト「自然言語処理」 6章 意味の解析(1)
放送大学テキスト「自然言語処理」 6章 意味の解析(1)
 
キーボード自作のススメ
キーボード自作のススメキーボード自作のススメ
キーボード自作のススメ
 
レトリバのキートップ説明書
レトリバのキートップ説明書レトリバのキートップ説明書
レトリバのキートップ説明書
 
ブースティング入門
ブースティング入門ブースティング入門
ブースティング入門
 
情報検索の基礎
情報検索の基礎情報検索の基礎
情報検索の基礎
 
Chainer の Trainer 解説と NStepLSTM について
Chainer の Trainer 解説と NStepLSTM についてChainer の Trainer 解説と NStepLSTM について
Chainer の Trainer 解説と NStepLSTM について
 
ChainerでDeep Learningを試すために必要なこと
ChainerでDeep Learningを試すために必要なことChainerでDeep Learningを試すために必要なこと
ChainerでDeep Learningを試すために必要なこと
 
20170221 cnet live講演資料
20170221 cnet live講演資料20170221 cnet live講演資料
20170221 cnet live講演資料
 
Making Google Cardboard and Laser Cutter
Making Google Cardboard and Laser CutterMaking Google Cardboard and Laser Cutter
Making Google Cardboard and Laser Cutter
 
Chainerで学ぶdeep learning
Chainerで学ぶdeep learningChainerで学ぶdeep learning
Chainerで学ぶdeep learning
 

Recently uploaded

Using Xen Hypervisor for Functional Safety
Using Xen Hypervisor for Functional SafetyUsing Xen Hypervisor for Functional Safety
Using Xen Hypervisor for Functional Safety
Ayan Halder
 
socradar-q1-2024-aviation-industry-report.pdf
socradar-q1-2024-aviation-industry-report.pdfsocradar-q1-2024-aviation-industry-report.pdf
socradar-q1-2024-aviation-industry-report.pdf
SOCRadar
 
zOS Mainframe JES2-JES3 JCL-JECL Differences
zOS Mainframe JES2-JES3 JCL-JECL DifferenceszOS Mainframe JES2-JES3 JCL-JECL Differences
zOS Mainframe JES2-JES3 JCL-JECL Differences
YousufSait3
 
316895207-SAP-Oil-and-Gas-Downstream-Training.pptx
316895207-SAP-Oil-and-Gas-Downstream-Training.pptx316895207-SAP-Oil-and-Gas-Downstream-Training.pptx
316895207-SAP-Oil-and-Gas-Downstream-Training.pptx
ssuserad3af4
 
Unveiling the Advantages of Agile Software Development.pdf
Unveiling the Advantages of Agile Software Development.pdfUnveiling the Advantages of Agile Software Development.pdf
Unveiling the Advantages of Agile Software Development.pdf
brainerhub1
 
Mobile app Development Services | Drona Infotech
Mobile app Development Services  | Drona InfotechMobile app Development Services  | Drona Infotech
Mobile app Development Services | Drona Infotech
Drona Infotech
 
SMS API Integration in Saudi Arabia| Best SMS API Service
SMS API Integration in Saudi Arabia| Best SMS API ServiceSMS API Integration in Saudi Arabia| Best SMS API Service
SMS API Integration in Saudi Arabia| Best SMS API Service
Yara Milbes
 
Using Query Store in Azure PostgreSQL to Understand Query Performance
Using Query Store in Azure PostgreSQL to Understand Query PerformanceUsing Query Store in Azure PostgreSQL to Understand Query Performance
Using Query Store in Azure PostgreSQL to Understand Query Performance
Grant Fritchey
 
UI5con 2024 - Keynote: Latest News about UI5 and it’s Ecosystem
UI5con 2024 - Keynote: Latest News about UI5 and it’s EcosystemUI5con 2024 - Keynote: Latest News about UI5 and it’s Ecosystem
UI5con 2024 - Keynote: Latest News about UI5 and it’s Ecosystem
Peter Muessig
 
GreenCode-A-VSCode-Plugin--Dario-Jurisic
GreenCode-A-VSCode-Plugin--Dario-JurisicGreenCode-A-VSCode-Plugin--Dario-Jurisic
GreenCode-A-VSCode-Plugin--Dario-Jurisic
Green Software Development
 
Oracle 23c New Features For DBAs and Developers.pptx
Oracle 23c New Features For DBAs and Developers.pptxOracle 23c New Features For DBAs and Developers.pptx
Oracle 23c New Features For DBAs and Developers.pptx
Remote DBA Services
 
Lecture 2 - software testing SE 412.pptx
Lecture 2 - software testing SE 412.pptxLecture 2 - software testing SE 412.pptx
Lecture 2 - software testing SE 412.pptx
TaghreedAltamimi
 
SQL Accounting Software Brochure Malaysia
SQL Accounting Software Brochure MalaysiaSQL Accounting Software Brochure Malaysia
SQL Accounting Software Brochure Malaysia
GohKiangHock
 
How Can Hiring A Mobile App Development Company Help Your Business Grow?
How Can Hiring A Mobile App Development Company Help Your Business Grow?How Can Hiring A Mobile App Development Company Help Your Business Grow?
How Can Hiring A Mobile App Development Company Help Your Business Grow?
ToXSL Technologies
 
Transform Your Communication with Cloud-Based IVR Solutions
Transform Your Communication with Cloud-Based IVR SolutionsTransform Your Communication with Cloud-Based IVR Solutions
Transform Your Communication with Cloud-Based IVR Solutions
TheSMSPoint
 
ALGIT - Assembly Line for Green IT - Numbers, Data, Facts
ALGIT - Assembly Line for Green IT - Numbers, Data, FactsALGIT - Assembly Line for Green IT - Numbers, Data, Facts
ALGIT - Assembly Line for Green IT - Numbers, Data, Facts
Green Software Development
 
Microservice Teams - How the cloud changes the way we work
Microservice Teams - How the cloud changes the way we workMicroservice Teams - How the cloud changes the way we work
Microservice Teams - How the cloud changes the way we work
Sven Peters
 
Requirement Traceability in Xen Functional Safety
Requirement Traceability in Xen Functional SafetyRequirement Traceability in Xen Functional Safety
Requirement Traceability in Xen Functional Safety
Ayan Halder
 
E-Invoicing Implementation: A Step-by-Step Guide for Saudi Arabian Companies
E-Invoicing Implementation: A Step-by-Step Guide for Saudi Arabian CompaniesE-Invoicing Implementation: A Step-by-Step Guide for Saudi Arabian Companies
E-Invoicing Implementation: A Step-by-Step Guide for Saudi Arabian Companies
Quickdice ERP
 
E-commerce Development Services- Hornet Dynamics
E-commerce Development Services- Hornet DynamicsE-commerce Development Services- Hornet Dynamics
E-commerce Development Services- Hornet Dynamics
Hornet Dynamics
 

Recently uploaded (20)

Using Xen Hypervisor for Functional Safety
Using Xen Hypervisor for Functional SafetyUsing Xen Hypervisor for Functional Safety
Using Xen Hypervisor for Functional Safety
 
socradar-q1-2024-aviation-industry-report.pdf
socradar-q1-2024-aviation-industry-report.pdfsocradar-q1-2024-aviation-industry-report.pdf
socradar-q1-2024-aviation-industry-report.pdf
 
zOS Mainframe JES2-JES3 JCL-JECL Differences
zOS Mainframe JES2-JES3 JCL-JECL DifferenceszOS Mainframe JES2-JES3 JCL-JECL Differences
zOS Mainframe JES2-JES3 JCL-JECL Differences
 
316895207-SAP-Oil-and-Gas-Downstream-Training.pptx
316895207-SAP-Oil-and-Gas-Downstream-Training.pptx316895207-SAP-Oil-and-Gas-Downstream-Training.pptx
316895207-SAP-Oil-and-Gas-Downstream-Training.pptx
 
Unveiling the Advantages of Agile Software Development.pdf
Unveiling the Advantages of Agile Software Development.pdfUnveiling the Advantages of Agile Software Development.pdf
Unveiling the Advantages of Agile Software Development.pdf
 
Mobile app Development Services | Drona Infotech
Mobile app Development Services  | Drona InfotechMobile app Development Services  | Drona Infotech
Mobile app Development Services | Drona Infotech
 
SMS API Integration in Saudi Arabia| Best SMS API Service
SMS API Integration in Saudi Arabia| Best SMS API ServiceSMS API Integration in Saudi Arabia| Best SMS API Service
SMS API Integration in Saudi Arabia| Best SMS API Service
 
Using Query Store in Azure PostgreSQL to Understand Query Performance
Using Query Store in Azure PostgreSQL to Understand Query PerformanceUsing Query Store in Azure PostgreSQL to Understand Query Performance
Using Query Store in Azure PostgreSQL to Understand Query Performance
 
UI5con 2024 - Keynote: Latest News about UI5 and it’s Ecosystem
UI5con 2024 - Keynote: Latest News about UI5 and it’s EcosystemUI5con 2024 - Keynote: Latest News about UI5 and it’s Ecosystem
UI5con 2024 - Keynote: Latest News about UI5 and it’s Ecosystem
 
GreenCode-A-VSCode-Plugin--Dario-Jurisic
GreenCode-A-VSCode-Plugin--Dario-JurisicGreenCode-A-VSCode-Plugin--Dario-Jurisic
GreenCode-A-VSCode-Plugin--Dario-Jurisic
 
Oracle 23c New Features For DBAs and Developers.pptx
Oracle 23c New Features For DBAs and Developers.pptxOracle 23c New Features For DBAs and Developers.pptx
Oracle 23c New Features For DBAs and Developers.pptx
 
Lecture 2 - software testing SE 412.pptx
Lecture 2 - software testing SE 412.pptxLecture 2 - software testing SE 412.pptx
Lecture 2 - software testing SE 412.pptx
 
SQL Accounting Software Brochure Malaysia
SQL Accounting Software Brochure MalaysiaSQL Accounting Software Brochure Malaysia
SQL Accounting Software Brochure Malaysia
 
How Can Hiring A Mobile App Development Company Help Your Business Grow?
How Can Hiring A Mobile App Development Company Help Your Business Grow?How Can Hiring A Mobile App Development Company Help Your Business Grow?
How Can Hiring A Mobile App Development Company Help Your Business Grow?
 
Transform Your Communication with Cloud-Based IVR Solutions
Transform Your Communication with Cloud-Based IVR SolutionsTransform Your Communication with Cloud-Based IVR Solutions
Transform Your Communication with Cloud-Based IVR Solutions
 
ALGIT - Assembly Line for Green IT - Numbers, Data, Facts
ALGIT - Assembly Line for Green IT - Numbers, Data, FactsALGIT - Assembly Line for Green IT - Numbers, Data, Facts
ALGIT - Assembly Line for Green IT - Numbers, Data, Facts
 
Microservice Teams - How the cloud changes the way we work
Microservice Teams - How the cloud changes the way we workMicroservice Teams - How the cloud changes the way we work
Microservice Teams - How the cloud changes the way we work
 
Requirement Traceability in Xen Functional Safety
Requirement Traceability in Xen Functional SafetyRequirement Traceability in Xen Functional Safety
Requirement Traceability in Xen Functional Safety
 
E-Invoicing Implementation: A Step-by-Step Guide for Saudi Arabian Companies
E-Invoicing Implementation: A Step-by-Step Guide for Saudi Arabian CompaniesE-Invoicing Implementation: A Step-by-Step Guide for Saudi Arabian Companies
E-Invoicing Implementation: A Step-by-Step Guide for Saudi Arabian Companies
 
E-commerce Development Services- Hornet Dynamics
E-commerce Development Services- Hornet DynamicsE-commerce Development Services- Hornet Dynamics
E-commerce Development Services- Hornet Dynamics
 

Linuxカーネルを読んで改めて知るプロセスとスレッドの違い

  • 1. 8 A 1. 0 1., 2 1 2 1
  • 2. / 2/ , 5 44 201 8 /8/ /. • ed 8 • R@ I • a • cg A @
  • 3. • c c gd t l • c efho t Rs • t c gd = I • t i a • 81 . , 8 3 81 . . ., 82 t • c xu t i a Rs A • efho n • i a c rv .8 2.: , 33 2018 . . :.
  • 4. • 02 8 I RA L R A cd • I • a e • I 0 2 11 0. 4 4 ,
  • 5. • .: C I c il • A 8: C 4 2 5A : C • ,/1 .: 2 G il • A 8 C 8 A 7 2 : 4 A 2 5 • aI Rnv otRghm I I fsL U • I I Rbd r U • .: C Rpue UN 0 : 2 4 :8 A A 5
  • 6. • • 0268A L • • • • R a • I • 0 2 11 0. ,
  • 7. ( 0 0 - 7. ) 2 0 0 0 • 18 • A I • A I • 18 • 18 ,18 R #include <stdio.h> #include <unistd.h> int main() { pid_t pid = fork(); // forkA if (pid == -1) { printf("Fork failed¥n"); // } else if (pid == 0) { printf("Child process, pid: %d¥n", getpid()); // } else { printf("Parent process, pid: %d¥n", getpid()); } } $ gcc fork_sample.c && ./a.out Parent process, pid: 72390 Child process, pid: 72391
  • 8. 0 A: 2 . 4# A:8 A A 5# • , 8: #4 A 2 5 : (# A 7 A #4 / ) • 17 A RL15 17 A I #ifdef __ARCH_WANT_SYS_FORK SYSCALL_DEFINE0(fork) { #ifdef CONFIG_MMU return _do_fork(SIGCHLD, 0, 0, NULL, NULL, 0); #else /* can not support in nommu mode */ return -EINVAL; #endif } #endif
  • 9. • • 02 8A L • • • • R a • I • 9 0 2 11 0. ,
  • 10. 8 8 << 8 8 8 • .-0 8 GT • I G.-0 O S • NP • AC1 8 • , .1 • ,.1 ,2 < GLR
  • 11. ). 1. ( , 1 0 8 .8. . • 0 . , . . I • 0 . 2 1 I R A #include <stdio.h> #include <pthread.h> void* print_doubled(void *x) { int *ix = (int *)x; printf("%d¥n", *ix * 2); } int main() { pthread_t th; int x = 100; int ret = pthread_create( &th, NULL, print_doubled, (void *)&x); if (ret != 0) { printf("thread execution failed"); return 255; } pthread_join(th, NULL); return 0; } $ gcc -lpthread pthread_sample.c $ ./a.out 200
  • 12. ( ( # 2 : 2 / 70 66 : :2 2: 21 • 7 6 :2/1.0:2/ 2 0 , # • R • 72 :2/1 I 1 • / : :2/1. :2/1./ : • /: .:8 72 I A LR • /: /: .:8 72 R int __pthread_create_2_1 (pthread_t *newthread, const pthread_attr_t *attr, void *(*start_routine) (void *), void *arg)
  • 13. ( ( 2 , ) (33 201 8 8 . • 1 ,. 8 , 2 , 0 A • , 1 ,. 1 ,. int __pthread_create_2_1 (pthread_t *newthread, const pthread_attr_t *attr, void *(*start_routine) (void *), void *arg) { const struct pthread_attr *iattr = (struct pthread_attr *) attr; struct pthread *pd = NULL; int err = ALLOCATE_STACK(iattr, &pd); /* */ pd->start_routine = start_routine; pd->arg = arg; /* */ *newthread = (pthread_t) pd; /* */ int retval = create_thread(pd, iattr, ...); return retval; }
  • 14. 8 8 / # A 8A8 87# ( • A A78 A C E A A CE 8 8 8 7# 0() • ,.4,021 A A4 8 R HN O IL static int create_thread (struct pthread *pd, const struct pthread_attr *attr, bool *stopped_start, STACK_VARIABLES_PARMS, bool *thread_ran) { /* */ const int clone_flags = (CLONE_VM | CLONE_FS | CLONE_FILES | CLONE_SYSVSEM | CLONE_SIGHAND | CLONE_THREAD | CLONE_SETTLS | CLONE_PARENT_SETTID | CLONE_CHILD_CLEARTID | 0); /* */ ARCH_CLONE(&start_thread, STACK_VARIABLES_PARMS, clone_flags, pd, &pd->tid, tp, &pd->tid); /* */ return 0; }
  • 15. 0 A: 2 . 4# A:8 A A 5# ) • , 8: #4 A 2 5 : (# A 7 A #4 / • 14 15 17 A L I SYSCALL_DEFINE5(clone, unsigned long, clone_flags, unsigned long, newsp, int __user *, parent_tidptr, int __user *, child_tidptr, unsigned long, tls) { return _do_fork(clone_flags, newsp, 0, parent_tidptr, child_tidptr, tls); }
  • 16. ) ) ( I GEA H: 0C EA GF E F EH • N LM _ O DC > : FO • TV 60. 1 • RS 1 , 82 1 , -6 1 , -01,6 1 , ,
  • 17. M I : /D IH H • IIFH D LAC EH D AF IC 0 C:D F: H C:D ED IC • 0 2, 81 • Rx mtedV mted Sop u • 0 2, - • Rx mtedV mtedP S rcdhn v T • 0 2, -/0, • Rx mtedV mted ri_da m hNlr v T • 0 2, 7. , • mted Rx mtedV Sdsgj rNm O
  • 18. # . / , 1 77 45 2 /* * cloning flags: */ #define CSIGNAL 0x000000ff /* signal mask to be sent at exit */ #define CLONE_VM 0x00000100 /* set if VM shared between processes */ #define CLONE_FS 0x00000200 /* set if fs info shared between processes */ #define CLONE_FILES 0x00000400 /* set if open files shared between processes */ #define CLONE_SIGHAND 0x00000800 /* set if signal handlers and blocked signals shared */ /* */ #define CLONE_NEWPID 0x20000000 /* New pid namespace */ #define CLONE_NEWNET 0x40000000 /* New network namespace */ #define CLONE_IO 0x80000000 /* Clone io context */ • 5 4 5 0 1:8 : /72 7 A 07:0 17 2 / 7 A 15 2 5 • L 0 • I 0 4 /7
  • 19. 8 , ) ( 8 12 9 8 9 8 . • _ Ied 0 8 R A • Ied R A • I R . 0 8 • ed fcI ag
  • 20. • • 1 R L • I R • • IA • 8 , 2 , 1 00 2 . 2, ,2 ,
  • 21. # . A 7 / , 1 75 A 2 • AA 57A 0 1 : A / 2 7 0 0 8 4 8 1 # • R I L long _do_fork(unsigned long clone_flags, unsigned long stack_start, unsigned long stack_size, int __user *parent_tidptr, int __user *child_tidptr, unsigned long tls)
  • 22. # /5A 85 1 ,:: 8 7A 5 5 54 • 7AA 8A7 2 A 1:4 :8 2: 2 8 : 45 :8 754 7 . • A1 90 A A aI b • _ R L struct task_struct { struct thread_info thread_info; volatile long state; void *stack; struct mm_struct *mm; struct mm_struct *active_mm; pid_t pid; pid_t tgid; /* Filesystem information */ struct fs_struct *fs; /* Open file information */ struct files_struct *files; /* c */ }
  • 23. 2 , ) ( 201 . • I A I • ,3 , 3 I R A 8 long _do_fork(unsigned long clone_flags, unsigned long stack_start, unsigned long stack_size, int __user *parent_tidptr, int __user *child_tidptr, unsigned long tls) { struct task_struct *p; /* */ p = copy_process( clone_flags, stack_start, stack_size, child_tidptr, NULL, trace, tls, NUMA_NO_NODE); /* */ struct pid *pid = get_task_pid(p, PIDTYPE_PID); long nr = pid_vnr(pid); wake_up_new_task(p); /* */ return nr; }
  • 24. 0 A: 2 . 4# A:8 A A 5# ( • , 8: #4 A 2 5 : (# A 7 A #4 / ) • 5 1 2 1 A 4 • m Rb hf o I di a kr • 4 1 • p Rh_ m e • nl e g c L static struct task_struct *copy_process( unsigned long clone_flags, unsigned long stack_start, unsigned long stack_size, int __user *child_tidptr, ...) { struct task_struct *p; int retval; /* s */ p = dup_task_struct(current, node); /* s */ retval = copy_fs(clone_flags, p); if (retval) goto bad_fork_cleanup_files; retval = copy_mm(clone_flags, p); if (retval) goto bad_fork_cleanup_signal; /* s */ return p; }
  • 25. N # 4 I 8 . : I • II I :EC IE 8 L E A E A : / • :E M7CCt mnpus diP U R • : I vx, 5 I8 A7 I :I ah e lbr • e gh ,/21 7 0 oc y V_ diPV_ Ok rfe ,/21 7 0 oc y V_ diP static int copy_mm(unsigned long clone_flags, struct task_struct *tsk) { struct mm_struct *mm, *oldmm; /* */ oldmm = current->mm; /* */ if (clone_flags & CLONE_VM) { mmget(oldmm); mm = oldmm; goto good_mm; } mm = dup_mm(tsk); good_mm: tsk->mm = mm; tsk->active_mm = mm; return 0; /* */ }
  • 26. 0 22 0. 6 6 , • A 61 6 8 a • _ 2 R I A c • d A
  • 27. • • 02 8A R • • R • L I • 0 7 2 11 0. 7 ,
  • 28. • l Sd O l • Sd O ah • = i c I Ie n R ad A • ISd O g 8 . 1. , 22 1 0 . . .
  • 29. ( ( ) ( I , 28 8 4 0 # / 9: 8 8 87# • : A . 9 : 5# 4 7 5 5 )# 8 8 :87 8# 1 ,( • :3 abed g RL :3 _ c g R static __always_inline struct rq * context_switch(struct rq *rq, struct task_struct *prev, struct task_struct *next, /* h */) { struct mm_struct *mm, *oldmm; mm = next->mm; old_mm = prev->active_mm; /* h */ if (!mm) { /* h */ } else switch_mm_irqs_off(oldmm, mm, next); /* h */ switch_to(prev, next, prev); barrier(); return finish_task_switch(prev); }
  • 30. ) ( ) # /4 74A0 :2 ,88 7 6 4 4 A43 # • 6 7 6 1 2 A083 87: 18 1 A 0 26 81 2 . • R I L void switch_mm_irqs_off(struct mm_struct * prev, struct mm_struct *next, struct task_struct *tsk) { struct mm_struct *real_prev = this_cpu_read(cpu_tlbstate.loaded_mm); if (real_prev == next) { /* */ return; } else { /* */ } /* */ }
  • 31. 8 . 1. 3, 22 1 0 . . . • i a d R c • a ge l nA I Sc O h
  • 32. • a • 02 8 L R • I • R I • R c • • A 30 2 11 30. 3 3 ,
  • 33. 0 0 ) . ( 23 0 0 0 • go 18 h A I nad . 8 0 h A I R , . v I , 8,18 R • nad x . 8 0fk l_A go s R • nad i ltr s R c a go L • 18 u Ae I L i
  • 34. /4A 74 0 - 2 ,:: 7 A 4 4 43 • da.7 g l • .7 R bmLjihc • AA 71 2 34 4: 4 9 8 :7 :71 0 : :7 24 0 0 4 4 A 7 34 A : • .7 • AA 797 17A 7 4 2 :7 94 4: 4 • L e kI • AA 3 0A4 0 4 8 0 0
  • 35. 1. 0 1., 2 1 2 1