HPE GreenLake Administration
- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - OpenVMS
- >
- Re: why create sharememory failed in the thread
Operating System - OpenVMS
1830045
Members
12575
Online
109998
Solutions
Forums
Categories
Company
Local Language
back
Forums
Discussions
Forums
- Data Protection and Retention
- Entry Storage Systems
- Legacy
- Midrange and Enterprise Storage
- Storage Networking
- HPE Nimble Storage
Discussions
Forums
Discussions
Discussions
Discussions
Forums
Discussions
back
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
- BladeSystem Infrastructure and Application Solutions
- Appliance Servers
- Alpha Servers
- BackOffice Products
- Internet Products
- HPE 9000 and HPE e3000 Servers
- Networking
- Netservers
- Secure OS Software for Linux
- Server Management (Insight Manager 7)
- Windows Server 2003
- Operating System - Tru64 Unix
- ProLiant Deployment and Provisioning
- Linux-Based Community / Regional
- Microsoft System Center Integration
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Blogs
Information
Community
Resources
Community Language
Language
Forums
Blogs
Topic Options
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-26-2005 12:55 PM
04-26-2005 12:55 PM
why create sharememory failed in the thread
I had wrote a program,and create sharememory suceessful in process(you can name it main thread also),but failed in thread when threads number is large(about 100).why?
2 REPLIES 2
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-26-2005 02:09 PM
04-26-2005 02:09 PM
Re: why create sharememory failed in the thread
Tianbinraindrop,
My first thought was that having more threads would consume more of your virtual address space, at least with their stacks. If you use the default stack size, though, then 100 thread stacks will use a small percentage of your gigabyte. I wonder whether the stack size was changed with the pthread_attr_setstacksize function.
When you mention creating shared memory, do you mean a global section, shared between processes, or something shared between threads within a process.
Or, do you mean that each thread is creating some memory, in which case you might run out of virtual address space if you make more threads.
I think we need to know what error status you see when it fails, and more details about your program and what it does.
--Travis Craig
My first thought was that having more threads would consume more of your virtual address space, at least with their stacks. If you use the default stack size, though, then 100 thread stacks will use a small percentage of your gigabyte. I wonder whether the stack size was changed with the pthread_attr_setstacksize function.
When you mention creating shared memory, do you mean a global section, shared between processes, or something shared between threads within a process.
Or, do you mean that each thread is creating some memory, in which case you might run out of virtual address space if you make more threads.
I think we need to know what error status you see when it fails, and more details about your program and what it does.
--Travis Craig
My head is cold.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-27-2005 03:58 AM
04-27-2005 03:58 AM
Re: why create sharememory failed in the thread
thank you for answer.My program create about 100 threads to do something.
but use only one thread to map sharememory.The purpose of sharememory is to
share information between processes.I use posix api to create and map sharememory.
The code is list here:
#ifdef __vms
bool CShareMemoryClient::map()
{
int m_memory_handle = shm_open (m_memory_name.c_str(), O_RDWR, 0);
if(m_memory_handle == -1)
{
return(false);
}
struct stat m_stat;
fstat(m_memory_handle,&m_stat);
m_memory_size = m_stat.st_size;
m_pMemory = mmap (0, m_memory_size, PROT_READ | PROT_WRITE, MAP_SHARED, m_memory_handle, 0);
if (m_pMemory == MAP_FAILED)
{
return false;
}
close (m_memory_handle);
return(true);
}
#endif
when the thread run,the first call will fail(at shm_open call).When I decreased threads number,It did well.
I had try pthread-xx-setstacksize,but no effect.
but use only one thread to map sharememory.The purpose of sharememory is to
share information between processes.I use posix api to create and map sharememory.
The code is list here:
#ifdef __vms
bool CShareMemoryClient::map()
{
int m_memory_handle = shm_open (m_memory_name.c_str(), O_RDWR, 0);
if(m_memory_handle == -1)
{
return(false);
}
struct stat m_stat;
fstat(m_memory_handle,&m_stat);
m_memory_size = m_stat.st_size;
m_pMemory = mmap (0, m_memory_size, PROT_READ | PROT_WRITE, MAP_SHARED, m_memory_handle, 0);
if (m_pMemory == MAP_FAILED)
{
return false;
}
close (m_memory_handle);
return(true);
}
#endif
when the thread run,the first call will fail(at shm_open call).When I decreased threads number,It did well.
I had try pthread-xx-setstacksize,but no effect.
The opinions expressed above are the personal opinions of the authors, not of Hewlett Packard Enterprise. By using this site, you accept the Terms of Use and Rules of Participation.
Company
Events and news
Customer resources
© Copyright 2025 Hewlett Packard Enterprise Development LP