Explore chapters and articles related to this topic
Network Communication
Published in Ivan Cibrario Bertolotti, Gabriele Manduchi, Real-Time Embedded Systems, 2017
Ivan Cibrario Bertolotti, Gabriele Manduchi
The above program can be turned into a multithreaded server just replacing the external loop accepting incoming connections as follows: /∗ Thread routine. It calls routine handleConnection () defined in the previous program. ∗/ static void * connectionHandler( void *arg) { int currSock = *( int *) arg; handleConnection( currSock ); free( arg ); pthread_exit(0); return NULL ; } ... /∗ Replacement of the external ( accept ) loop of the previous program ∗/ for (;;) { /∗ Allocate the current socket. It will be freed just before thread termination. ∗/ currSd = malloc ( sizeof ( int )); if ((* currSd = accept (sd, ( struct sockaddr *) & retSin, & sAddrLen )) == -1) { perror (" accept "); exit (1); } printf (" Connection received from %s\n", inet_ntoa( retSin . sin_addr )); /∗ Connection received, start a new thread serving the connection ∗/ pthread_create(& handler, NULL, connectionHandler, currSd ); }
Execution Environment
Published in Hamidreza Ahmadian, Roman Obermaisser, Jon Perez, Distributed Real-Time Architecture for Mixed-Criticality Systems, 2018
A. Crespo, P. Balbastre, K. Chappuis, J. Coronel, J. Fanguède, P. Lucas, J. Perez
An example of the first kind of errors is the ‘malloc()’ function that returns a null pointer because there is not memory enough to attend the request. This error is typically handled by the program by checking the return value. As for the second kind, an attempt to execute an undefined instruction (processor instruction) may not be properly handled by a program that attempted to execute it. The XtratuM HM component manages those faults that cannot, or should not, be managed at the scope where the fault occurs.
Sizing Analogue Integrated Circuits by Integer Encoding and NSGA-II
Published in IETE Technical Review, 2018
A. C. Sanabria-Borbón, E. Tlelo-Cuautle
Table 2 lists the statistical values for the feasible solutions. In this case of study, both integer and real encodings show similar optimized performances. The algorithm was run in an i7 INTEL processor, the running time using real encoding is 1072.54 seconds, while using integer encoding, it takes 880.31 seconds to run. Therefore, our proposed integer encoding presents a reduction in CPU time. With respect to the memory usage, malloc function is used for dynamic memory assignation. The data type is double for the real encoding and int for the integer one; in consequence, the dynamic memory usage is reduced to half applying our proposed integer encoding.