Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7953121
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 4, 20262026-06-04T03:04:06+00:00 2026-06-04T03:04:06+00:00

In Linux is it possible to start a process (e.g. with execve ) and

  • 0

In Linux is it possible to start a process (e.g. with execve) and make it use a particular memory region as stack space?

Background:

I have a C++ program and a fast allocator that gives me “fast memory”. I can use it for objects that make use of the heap and create them in fast memory. Fine. But I also have a lot of variable living on the stack. How can I make them use the fast memory as well?

Idea: Implement a “program wrapper” that allocates fast memory and then starts the actual main program, passing a pointer to the fast memory and the program uses it as stack. Is that possible?

[Update]

The pthread setup seems to work.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-04T03:04:07+00:00Added an answer on June 4, 2026 at 3:04 am

    With pthreads, you could use a secondary thread for your program logic, and set its stack address using pthread_attr_setstack():

    NAME
           pthread_attr_setstack,  pthread_attr_getstack  -  set/get stack
           attributes in thread attributes object
    
    SYNOPSIS
           #include <pthread.h>
    
           int pthread_attr_setstack(pthread_attr_t *attr,
                                     void *stackaddr, size_t stacksize);
    
    DESCRIPTION
           The pthread_attr_setstack() function sets the stack address and
           stack  size attributes of the thread attributes object referred
           to by attr to the values specified in stackaddr and  stacksize,
           respectively.   These  attributes specify the location and size
           of the stack that should be used by a thread  that  is  created
           using the thread attributes object attr.
    
           stackaddr should point to the lowest addressable byte of a buf‐
           fer of stacksize bytes that was allocated by the  caller.   The
           pages  of  the  allocated  buffer  should  be both readable and
           writable.
    

    What I don’t follow is how you’re expecting to get any performance improvements out of doing something like this (I assume the purpose of your “fast” memory is better performance).

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Possible Duplicate: Starting iPhone app development in Linux? Is there a way to use
Possible Duplicate: Threads vs Processes in Linux To implement multi-tasks programs we could use
Is it possible to create binaries of other platform on Linux? Say I have
Is there any ready-to-use solution to log the memory consumption from the start of
?Is it possible to start an x86_64 code on i686 Linux (x86, 32-bit)? My
Is it possible to start and stop a commandline program from php (on the
My team is planning to start development on linux platform. Previously we have been
Is it possible to read Windows 2008 LDM partitions in Linux? We have five
Is it possible to compile a linux kernel(2.6) module that includes functionality defined by
Is it possible to hide the Linux hidden files (.* files) in Windows? Does

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.