From 6c599534dbfecabdcdfc6138b94020200611f52e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ciro=20Santilli=20=E5=85=AD=E5=9B=9B=E4=BA=8B=E4=BB=B6=20?= =?UTF-8?q?=E6=B3=95=E8=BD=AE=E5=8A=9F?= Date: Wed, 11 Sep 2019 00:00:00 +0000 Subject: [PATCH] multithread: doc improvements --- README.adoc | 10 +++++----- userland/posix/pthread_self.c | 8 +++++++- 2 files changed, 12 insertions(+), 6 deletions(-) diff --git a/README.adoc b/README.adoc index 0718021..ee87cd4 100644 --- a/README.adoc +++ b/README.adoc @@ -10579,7 +10579,7 @@ cat /proc/cpuinfo getconf _NPROCESSORS_CONF .... -====== Number of cores in QEMU user mode +====== QEMU user mode multithreading TODO why in <> QEMU always shows the number of cores of the host. E.g., both of the following output the same as `nproc` on the host: @@ -10602,9 +10602,9 @@ Remember <> though. At 369a47fc6e5c2f4a7f911c1c058b6088f8824463 + 1 QEMU appears to spawn 3 host threads plus one for every new guest thread created. Remember that link:userland/posix/pthread_count.c[] spawns N + 1 total threads if you count the `main` thread. -====== Number of cores in gem5 user mode +====== gem5 syscall emulation multithreading -gem5 user mode multi core has been particularly flaky compared <>. +gem5 user mode multithreading has been particularly flaky compared <>. You have the limitation that you must have at least one core per guest thread, otherwise `pthread_create` fails. For example: @@ -13110,8 +13110,8 @@ The following sections are related to multithreading in userland: ** <> ** <> * emulator topics: -** <> -** <> +** <> +** <> === C debugging diff --git a/userland/posix/pthread_self.c b/userland/posix/pthread_self.c index 3f5c4d4..ed31227 100644 --- a/userland/posix/pthread_self.c +++ b/userland/posix/pthread_self.c @@ -3,10 +3,16 @@ * * https://cirosantilli.com/linux-kernel-module-cheat#pthreads * + * Usage: + * + * .... + * ./pthread_self.out [nthreads] + * .... + * * Sample usage: * * .... - * ./pthread_tid.out 4 + * ./pthread_self.out [nthreads] * .... * * Sample output: