# Linux Kernel Module Cheat

#### 24.3.1. Number of cores

    ./run --arch arm --cpus 2 --emulator gem5

Can be checked with `/proc/cpuinfo` or getconf in Ubuntu 18.04:

    cat /proc/cpuinfo
    getconf _NPROCESSORS_CONF

Or from User mode simulation, we can use either of:

- sysconf with userland/linux/sysconf.c

      ./run --cpus 2 --emulator gem5 --userland userland/linux/sysconf.c | grep _SC_NPROCESSORS_ONLN

- C++ multithreading's userland/cpp/thread_hardware_concurrency.cpp:

      ./run --cpus 2 --emulator gem5 --userland userland/cpp/thread_hardware_concurrency.cpp

- direct access to several special filesystem files that contain this information e.g. via userland/c/cat.c:

      ./run --cpus 2 --emulator gem5 --userland userland/c/cat.c --cli-args /proc/cpuinfo

- QEMU user mode multithreading

- gem5 ARM full system with more than 8 cores