Find the answer to your Linux question:
Results 1 to 2 of 2
Enjoy an ad free experience by logging in. Not a member yet? Register.
  1. #1

    Thumbs down Question about kernel stack

    When a process is created by fork(), kernel calls do_fork().
    do_fork() calls copy_process()
    and a union thread_union is created in the kernel memory space.

    union thread_union {
    struct thread_info thread_info;
    unsigned long stack[THREAD_SIZE/sizeof(long)];

    Usually, on IA32 the size of thread_union is 8KB.
    On some special machine architecture, the size is 4KB.

    | 8K| kernel stack
    | . . | |
    | . . | V
    | . . |------------------------
    | . . |
    | . . |-----------------------
    | 0. | thread info

    I wonder what kind of data will be put in the kernel stack. Since it only has a space of 8KB or 4KB, a rather small number, will there be a risk that the stack overflows?

  2. #2
    Linux Enthusiast gerard4143's Avatar
    Join Date
    Dec 2007
    Canada, Prince Edward Island
    The main purpose of the user's kernel stack is facilitate system calls which don't require a large stack...Gerard4143
    Make mine Arch Linux

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts