Monday, January 7, 2019

My basic mutex procedure in consent

This is a shared memory request, actually requesting each node in the enterprise to reserve a spot n their local args list, so we can why we want an infinite args.

But, just like block chain, the local request is placed on the block, or binary tree, sorted on index. Then the request is broadcast, and the segment labeled pending. The consent algorithm guaranteed to complete, or run in circles, so far.  The caller waits right there for the completion signal, and this code has a MsgHandler for inter node communications.  The pending count goes to zero as each node signs off.  Nodes can accumulate sign off messages, appending their own to a list. All so mem requests and releases can be accumulated at nodes by appending. But two conflicting requests may be flipped , randomly.

This is a few lines of code. We get here because there is a simple look upkeyed on args[*argc], almost the way c does it in main(). SO all snippets can have multiple interfaces, and reuse strncmp(), in a command sequence, simple enough. Very little boiler plate, but definitely go for a more advanced front end symbol table.

I am not worried about broadcast mess, because I know what send block of words on a socket looks like, already. So does every other snippet writer,in a basic sense; any socket.c has a one paragraph description of its args format.

// MemRequest meindex memsize
int MemRqst(int *argc,void * args[] ){
int base = *argc;
Request * r= args[base+1];
PNode p = find(&Start,r);
AddNode(p,r);  // but it is pending
p->pid= getpid();
MemBroadcast(p);  // Inform the other nodes
pthread_mutex_unlock(&xchars_mutex);
if(sigwait(SIGUSR1set,SIGUSR1))
syntax_error();
return(SUCCESS);
}

No comments: