zoukankan      html  css  js  c++  java
  • 测试当前机器可以创建多少线程

    ulimit -a
    core file size          (blocks, -c) 0
    data seg size           (kbytes, -d) unlimited
    scheduling priority             (-e) 0
    file size               (blocks, -f) unlimited
    pending signals                 (-i) 3612
    max locked memory       (kbytes, -l) 64
    max memory size         (kbytes, -m) unlimited
    open files                      (-n) 1024
    pipe size            (512 bytes, -p) 8
    POSIX message queues     (bytes, -q) 819200
    real-time priority              (-r) 0
    stack size              (kbytes, -s) 8192
    cpu time               (seconds, -t) unlimited
    max user processes              (-u) 3612
    virtual memory          (kbytes, -v) unlimited
    file locks                      (-x) unlimited
    #include <stdio.h>
    #include <stdlib.h>
    #include <stdbool.h>
    #include <unistd.h>
    #include <string.h>
    #include <strings.h>
    #include <errno.h>
    
    #include <sys/stat.h>
    #include <sys/types.h>
    #include <sys/wait.h>
    #include <fcntl.h>
    #include <pthread.h>
    
    void* threadWork(void* arg)
    {
        while(1)
            sleep(1);
    }
    
    int main(int argc, char **argv)
    {
        pthread_t thID;
        int i = 0;
        while(1)
        {
            int err = pthread_create(&thID,NULL,threadWork,NULL);
            if (err != 0)
            {
                printf("%s
    ",strerror(err));
                exit(1);
            }
            printf("%d
    ",i++);
        }
        return 0;
    }
  • 相关阅读:
    保存windows 10的登录界面壁纸
    Python 从剪贴板中生成二维码
    SpringBoot
    IDEA8条配置
    Nodejs-hexoBlog
    Mybatis-Plus
    Javaweb文件上传
    GIt基本语法
    JS常用部分整合
    javaweb-maven学习总结
  • 原文地址:https://www.cnblogs.com/xiangtingshen/p/11967965.html
Copyright © 2011-2022 走看看