shared-memory

php: delete shared memory on windows

强颜欢笑 提交于 2019-12-13 12:28:16
问题 This code: shmop_delete(); shmop_close(); doesn't delete shared memory. An experiment: $shmid = @shmop_open(1234, 'a', 0, 0); var_dump($shmid); yields bool(false) of course. But $shmid = shmop_open(5678, 'c', 0644, 10); ... shmop_delete($shmid); shmop_close($shmid); ... $shmid = @shmop_open(5678, 'a', 0, 0); var_dump($shmid); yields int(157) Why not deleted yet? How can I delete shared memory? I'm running apache on windows 7. 回答1: SHM is not natively available in Windows, so PHP tries to

Wants to create an application storing data in memory. But i dont want the data to be lost even if my app crashes [closed]

陌路散爱 提交于 2019-12-13 09:54:58
问题 Closed . This question needs to be more focused. It is not currently accepting answers. Want to improve this question? Update the question so it focuses on one problem only by editing this post. Closed 5 years ago . Wants to create an application storing data in memory. But i dont want the data to be lost even if my app crashes. What concept should i use? Should I use a shared memory, or is there some other concept that suits my requirement better. 回答1: You are asking for persistence (or even

sys v shared memory from kernel module to user space process

蓝咒 提交于 2019-12-13 07:18:14
问题 i am new in linux kernel module developpement and i am searching for sharing a memory segment from kernel module to user space process to escape latency of copying data. i am using the sys v shared memory api, when i share memory between two process it's work fine, but i am not able to share memory between process and kernel module. bellow is my code of the kernel module and the user space app server side : module #include <linux/module.h> // init_module, cleanup_module // #include <linux

Parallel array or array of structures [closed]

风格不统一 提交于 2019-12-13 07:09:11
问题 It's difficult to tell what is being asked here. This question is ambiguous, vague, incomplete, overly broad, or rhetorical and cannot be reasonably answered in its current form. For help clarifying this question so that it can be reopened, visit the help center. Closed 7 years ago . I am trying to implement a sparse matrix (COO format) framework in C for parallel computing (shared memory). Initially I was planning to have an array of struct of the spatial information. typedef struct {

sem_open doesn't work with Ubuntu : undefined reference to `sem_open'

[亡魂溺海] 提交于 2019-12-13 06:39:35
问题 Given this code : #include <stdio.h> #include <stdlib.h> #include <string.h> #include <sys/wait.h> #include <unistd.h> #include <fcntl.h> #include <sys/stat.h> #include <sys/types.h> #include <sys/shm.h> #include <semaphore.h> #include <pthread.h> #define BUF_SIZE 256 int main() { key_t key; char *virtualaddr; sem_t *get, *put; int shmid; const char* messageOne = "Hello world , I'm child number 1\n"; const char* messageTwo = "Hello world , I'm child number 2\n"; char buf[BUF_SIZE]; key = ftok

Shared memory C++ - PHP

隐身守侯 提交于 2019-12-13 06:22:12
问题 I am trying to create a shared memory segment in a C++ app. Then read it back on a web page. The C++ app will be the server. And my test code works with the shm_client.c example on this page. C++ code: key = 6565; if( (shmid = shmget( key, 27, IPC_CREAT | 0666 )) < 0 ) throw std::string( "shmget failed." ); if( (data = shmat( shmid, NULL, 0 )) < 0 ) throw std::string( "shmat failed" ); memset( data, 0, 27 ); strncpy( (char *)data, "Hello world", 27 ); I changed the key in shm_client.c to 6565

pycuda shared memory error “pycuda._driver.LogicError: cuLaunchKernel failed: invalid value”

僤鯓⒐⒋嵵緔 提交于 2019-12-13 04:42:21
问题 I have a strange problem which origin I cannot determine: I have a working Kernel for some special Matrix-Vector-multiplication, which I want to speed up. Basically the big matrix (10^6 times 10^6) is constructed from few small matrices. So I want to put that data in shared memory. However when I try to add the shared memory, I only get the error: pycuda._driver.LogicError: cuLaunchKernel failed: invalid value So my working kernel is: #define FIELD_SIZE {field} #define BLOCK_SIZE {block} _

How to coordinate shared memory between 2 processes

梦想与她 提交于 2019-12-13 01:34:43
问题 I have program A and program B. Program A makes a queue that's stored into the shared memory with shmget, then shmat. Process B starts up and then uses the same shmid to obtain the queue that process A made without a problem. Process A (both A and B are running at the same time obviously) then runs a method that modifies a certain element in the queue. When program A does this, the pointer to that memory block gives me a segmentation fault. probably because program B now has the pointer

System V shared memory permission bits: meaning, and how to change

妖精的绣舞 提交于 2019-12-13 01:23:21
问题 I know that when i create a shared memory block, we set the permission so that every proccess can read and write in that block with 0777 (no idea why, my teacher just said to use it like that). I'm creating with shmget as: shmget(IPC_PRIVATE, sizeof(server_config), IPC_CREAT|0777) However I'd like to know: What each number means How to change the flag after the shared memory block is created How to only allow 1 proccess to write, while all the other proccesses can only read 回答1: It's an octal

c/linux - ftruncate and POSIX Shared Memory Segments

拟墨画扇 提交于 2019-12-12 19:12:35
问题 The end goal here is that I'd like to be able to extend the size of a shared memory segment and notify processes to remap the segment after the extension. However it seems that calling ftruncate a second time on a shared memory fd fails with EINVAL. The only other question I could find about this has no answer: ftruncate failed at the second time The manpages for ftruncate and shm_open make no mention of disallowing the expansion of shared memory segments after creation, in fact they seem to