Search Results

Search found 7 results on 1 pages for 'fsdfa'.

Page 1/1 | 1 

  • Shared Memory and Process Sempahores (IPC)

    - by fsdfa
    This is an extract from Advanced Liniux Programming: Semaphores continue to exist even after all processes using them have terminated. The last process to use a semaphore set must explicitly remove it to ensure that the operating system does not run out of semaphores.To do so, invoke semctl with the semaphore identifier, the number of semaphores in the set, IPC_RMID as the third argument, and any union semun value as the fourth argument (which is ignored).The effective user ID of the calling process must match that of the semaphore’s allocator (or the caller must be root). Unlike shared memory segments, removing a semaphore set causes Linux to deallocate immediately. If a process allocate a shared memory, and many process use it and never set to delete it (with shmctl), if all them terminate, then the shared page continues being available. (We can see this with ipcs). If some process did the shmctl, then when the last process deattached, then the system will deallocate the shared memory. So far so good (I guess, if not, correct me). What I dont understand from that quote I did, is that first it say: "Semaphores continue to exist even after all processes using them have terminated." and then: "Unlike shared memory segments, removing a semaphore set causes Linux to deallocate immediately."

    Read the article

  • Continue executing with thrown exception?

    - by fsdfa
    There's something really weird, I have (in C++): func(); cout << "Heeey" << endl; And func, throws an exception: "throw string("ERROR");". But the cout is done, and the exception is successfully catched. Why it prints "Heeey" if there was an exception before?.

    Read the article

  • User to kernel mode big picture?

    - by fsdfa
    I've to implement a char device, a LKM. I know some basics about OS, but I feel I don't have the big picture. In a C programm, when I call a syscall what I think it happens is that the CPU is changed to ring0, then goes to the syscall vector and jumps to a kernel memmory space function that handle it. (I think that it does int 0x80 and in eax is the offset of the syscall vector, not sure). Then, I'm in the syscall itself, but I guess that for the kernel is the same process that was before, only that it is in kernel mode, I mean the current PCB is the process that called the syscall. So far... so good?, correct me if something is wrong. Others questions... how can I write/read in process memory?. If in the syscall handler I refer to address, say, 0xbfffffff. What it means that address? physical one? Some virtual kernel one?

    Read the article

  • make always rebuild

    - by fsdfa
    My Makefile is: OBJS = b.o c.o a.o FLAGS = -Wall -Werror CC = gcc test: $(OBJS) $(CC) $(FLAGS) $(OBJS) -o a b.o: b.c b.h $(CC) $(FLAGS) -c b.c a.o: a.c b.h c.h $(CC) $(FLAGS) -c a.c c.o: c.c c.h $(CC) $(FLAGS) -c c.c clean: rm a rm *.o all: test If I do make then make again, it always rebuilds 'test'. Why does it do this?

    Read the article

  • Real thing about "->" and "."

    - by fsdfa
    I always wanted to know what is the real thing difference of how the compiler see a pointer to a struct (in C suppose) and a struct itself. struct person p; struct person *pp; pp->age, I always imagine that the compiler does: "value of pp + offset of atribute "age" in the struct". But what it does with person.p? It would be almost the same. For me "the programmer", p is not a memory address, its like "the structure itself", but of course this is not how the compiler deal with it. My guess is it's more of a syntactic thing, and the compiler always does (&p)->age. I'm correct?

    Read the article

  • Auto-needed classes?

    - by fsdfa
    Suppose I have a class A and a class B. The .h of A, needs the .h of B, and the .h of B needs the .h of A. (need = #include). All .h have the guards: #ifndef _classX_ #define _classX_ ... ... #endif But if I compile the .cpp of A, then when it includes the .h of B, the B class cannot include the .h of A class because the A class has already use the guard. How can i solve this?

    Read the article

1