- About Petri nets and more.. - 1 Update
- About deadlocks and race conditions in parallel programming.. - 1 Update
- g++-question - 3 Updates
aminer68@gmail.com: Feb 03 03:15PM -0800 Hello, About Petri nets and more.. I have bought a book around year 2006 about Petri Nets for the level of Master's degree in Engineering schools, and i have read it(since i speak and write Arabic and English and French), here it is: https://www.amazon.ca/RESEAUX-PETRI-Choquet/dp/2100491474 It was written by a french PhD researcher called Annie Choquet-Geniet, here she is: https://www.researchgate.net/profile/Annie_Choquet-Geniet This is why i am also working with Petri Nets in Parallel programming.. Read the rest of my thoughts to understand better: About deadlocks and race conditions in parallel programming.. I have just read the following paper: Deadlock Avoidance in Parallel Programs with Futures https://cogumbreiro.github.io/assets/cogumbreiro-gorn.pdf So as you are noticing you can have deadlocks in parallel programming by introducing circular dependencies among tasks waiting on future values or you can have deadlocks by introducing circular dependencies among tasks waiting on windows event objects or such synchronisation objects, so you have to have a general tool that detects deadlocks, but if you are noticing that the tool called Valgrind for C++ can detect deadlocks only happening from Pthread locks , read the following to notice it: http://valgrind.org/docs/manual/hg-manual.html#hg-manual.lock-orders So this is not good, so you have to have a general way that permits to detect deadlocks on locks , mutexes, and deadlocks from introducing circular dependencies among tasks waiting on future values or deadlocks from introducing circular dependencies among tasks waiting on windows event objects or such synchronisation objects etc. this is why i wrote before about this general way that detects deadlocks, and here it is, read my following thoughts: Here is how to install Spin Model Checker on windows: I invite you to look at this video to learn how to install Spin model checker and iSpin: https://www.youtube.com/watch?v=MGzmtWi4Oq0 I have installed them and configured them correctly and i am working with them in parallel programming to detect race conditions etc., please read the rest of my thoughts to understand more: More precision about the invariants of a system.. I was just thinking about Petri nets , and i have studied more Petri nets, they are useful for parallel programming, and what i have noticed by studying them, is that there is two methods to prove that there is no deadlock in the system, there is the structural analysis with place invariants that you have to mathematically find, or you can use the reachability tree, but we have to notice that the structural analysis of Petri nets learns you more, because it permits you to prove that there is no deadlock in the system, and the place invariants are mathematically calculated by the following system of the given Petri net: Transpose(vector) * Incidence matrix = 0 So you apply the Gaussian Elimination or the Farkas algorithm to the incidence matrix to find the Place invariants, and as you will notice those place invariants calculations of the Petri nets look like Markov chains in mathematics, with there vector of probabilities and there transition matrix of probabilities, and you can, using Markov chains mathematically calculate where the vector of probabilities will "stabilize", and it gives you a very important information, and you can do it by solving the following mathematical system: Unknown vector1 of probabilities * transition matrix of probabilities = Unknown vector1 of probabilities. Solving this system of equations is very important in economics and other fields, and you can notice that it is like calculating the invariants , because the invariant in the system above is the vector1 of probabilities that is obtained, and this invariant, like in the invariants of the structural analysis of Petri nets, gives you a very important information about the system, like where market shares will stabilize that is calculated this way in economics. About reachability analysis of a Petri net.. As you have noticed in my Petri nets tutorial example (read below), i am analysing the liveness of the Petri net, because there is a rule that says: If a Petri net is live, that means that it is deadlock-free. Because reachability analysis of a Petri net with Tina gives you the necessary information about boundedness and liveness of the Petri net. So if it gives you that the Petri net is "live" , so there is no deadlock in it. Tina and Partial order reduction techniques.. With the advancement of computer technology, highly concurrent systems are being developed. The verification of such systems is a challenging task, as their state space grows exponentially with the number of processes. Partial order reduction is an effective technique to address this problem. It relies on the observation that the effect of executing transitions concurrently is often independent of their ordering. Tina is using "partial-order" reduction techniques aimed at preventing combinatorial explosion, Read more here to notice it: http://projects.laas.fr/tina/papers/qest06.pdf About modelizations and detection of race conditions and deadlocks in parallel programming.. I have just taken further a look at the following project in Delphi called DelphiConcurrent by an engineer called Moualek Adlene from France: https://github.com/moualek-adlene/DelphiConcurrent/blob/master/DelphiConcurrent.pas And i have just taken a look at the following webpage of Dr Dobb's journal: Detecting Deadlocks in C++ Using a Locks Monitor https://www.drdobbs.com/detecting-deadlocks-in-c-using-a-locks-m/184416644 And i think that both of them are using technics that are not as good as analysing deadlocks with Petri Nets in parallel applications , for example the above two methods are only addressing locks or mutexes or reader-writer locks , but they are not addressing semaphores or event objects and such other synchronization objects, so they are not good, this is why i have written a tutorial that shows my methodology of analysing and detecting deadlocks in parallel applications with Petri Nets, my methodology is more sophisticated because it is a generalization and it modelizes with Petri Nets the broader range of synchronization objects, and in my tutorial i will add soon other synchronization objects, you have to look at it, here it is: https://sites.google.com/site/scalable68/how-to-analyse-parallel-applications-with-petri-nets You have to get the powerful Tina software to run my Petri Net examples inside my tutorial, here is the powerful Tina software: http://projects.laas.fr/tina/ Also to detect race conditions in parallel programming you have to take a look at the following new tutorial that uses the powerful Spin tool: https://mirrors.edge.kernel.org/pub/linux/kernel/people/paulmck/perfbook/perfbook.html This is how you will get much more professional at detecting deadlocks and race conditions in parallel programming. Thank you, Amine Moulay Ramdane. |
aminer68@gmail.com: Feb 03 01:56PM -0800 Hello, About deadlocks and race conditions in parallel programming.. I have just read the following paper: Deadlock Avoidance in Parallel Programs with Futures https://cogumbreiro.github.io/assets/cogumbreiro-gorn.pdf So as you are noticing you can have deadlocks in parallel programming by introducing circular dependencies among tasks waiting on future values or you can have deadlocks by introducing circular dependencies among tasks waiting on windows event objects or such synchronisation objects, so you have to have a general tool that detects deadlocks, but if you are noticing that the tool called Valgrind for C++ can detect deadlocks only happening from Pthread locks , read the following to notice it: http://valgrind.org/docs/manual/hg-manual.html#hg-manual.lock-orders So this is not good, so you have to have a general way that permits to detect deadlocks on locks , mutexes, and deadlocks from introducing circular dependencies among tasks waiting on future values or deadlocks you may have deadlocks by introducing circular dependencies among tasks waiting on windows event objects or such synchronisation objects etc. this is why i have talked before about this general way that detects deadlocks, and here it is, read my following thoughts: Yet more precision about the invariants of a system.. I was just thinking about Petri nets , and i have studied more Petri nets, they are useful for parallel programming, and what i have noticed by studying them, is that there is two methods to prove that there is no deadlock in the system, there is the structural analysis with place invariants that you have to mathematically find, or you can use the reachability tree, but we have to notice that the structural analysis of Petri nets learns you more, because it permits you to prove that there is no deadlock in the system, and the place invariants are mathematically calculated by the following system of the given Petri net: Transpose(vector) * Incidence matrix = 0 So you apply the Gaussian Elimination or the Farkas algorithm to the incidence matrix to find the Place invariants, and as you will notice those place invariants calculations of the Petri nets look like Markov chains in mathematics, with there vector of probabilities and there transition matrix of probabilities, and you can, using Markov chains mathematically calculate where the vector of probabilities will "stabilize", and it gives you a very important information, and you can do it by solving the following mathematical system: Unknown vector1 of probabilities * transition matrix of probabilities = Unknown vector1 of probabilities. Solving this system of equations is very important in economics and other fields, and you can notice that it is like calculating the invariants , because the invariant in the system above is the vector1 of probabilities that is obtained, and this invariant, like in the invariants of the structural analysis of Petri nets, gives you a very important information about the system, like where market shares will stabilize that is calculated this way in economics. About reachability analysis of a Petri net.. As you have noticed in my Petri nets tutorial example (read below), i am analysing the liveness of the Petri net, because there is a rule that says: If a Petri net is live, that means that it is deadlock-free. Because reachability analysis of a Petri net with Tina gives you the necessary information about boundedness and liveness of the Petri net. So if it gives you that the Petri net is "live" , so there is no deadlock in it. Tina and Partial order reduction techniques.. With the advancement of computer technology, highly concurrent systems are being developed. The verification of such systems is a challenging task, as their state space grows exponentially with the number of processes. Partial order reduction is an effective technique to address this problem. It relies on the observation that the effect of executing transitions concurrently is often independent of their ordering. Tina is using "partial-order" reduction techniques aimed at preventing combinatorial explosion, Read more here to notice it: http://projects.laas.fr/tina/papers/qest06.pdf About modelizations and detection of race conditions and deadlocks in parallel programming.. I have just taken further a look at the following project in Delphi called DelphiConcurrent by an engineer called Moualek Adlene from France: https://github.com/moualek-adlene/DelphiConcurrent/blob/master/DelphiConcurrent.pas And i have just taken a look at the following webpage of Dr Dobb's journal: Detecting Deadlocks in C++ Using a Locks Monitor https://www.drdobbs.com/detecting-deadlocks-in-c-using-a-locks-m/184416644 And i think that both of them are using technics that are not as good as analysing deadlocks with Petri Nets in parallel applications , for example the above two methods are only addressing locks or mutexes or reader-writer locks , but they are not addressing semaphores or event objects and such other synchronization objects, so they are not good, this is why i have written a tutorial that shows my methodology of analysing and detecting deadlocks in parallel applications with Petri Nets, my methodology is more sophisticated because it is a generalization and it modelizes with Petri Nets the broader range of synchronization objects, and in my tutorial i will add soon other synchronization objects, you have to look at it, here it is: https://sites.google.com/site/scalable68/how-to-analyse-parallel-applications-with-petri-nets You have to get the powerful Tina software to run my Petri Net examples inside my tutorial, here is the powerful Tina software: http://projects.laas.fr/tina/ Also to detect race conditions in parallel programming you have to take a look at the following new tutorial that uses the powerful Spin tool: https://mirrors.edge.kernel.org/pub/linux/kernel/people/paulmck/perfbook/perfbook.html This is how you will get much more professional at detecting deadlocks and race conditions in parallel programming. Thank you, Amine Moulay Ramdane. |
Sam <sam@email-scan.com>: Feb 02 06:28PM -0500 Robert Wessel writes: > While storing the mangled type name makes sense (although an even more > compact representation might be even better), there's no reason name() > couldn't demangle it before returning. The second-to-last sentence of my paragraph, quoted above, explains the small technical complication this approach poses. |
Juha Nieminen <nospam@thanks.invalid>: Feb 03 10:25AM > Macros are only needed for conditional compilation in C++. > In other cases they're bad code. Not always. One example where a preprocessor macro is useful is when you want a code line number inserted into a message, eg. when doing some debugging or printing out error messages in some testing code. For example, wherever I write a testbed program for something, I often do it so that I can write tests like: if(someConditionFails) return DPRINT("Test X failed with value ", something, "."); In a testbed program with literally hundreds of complicated tests, it's quite useful if that message prints the line where the DPRINT() call is being made, as it makes it so much easier to find out which one of the myriads of tests failed specifically. In other words, it kind of works like an assertion failure, but with a message that can contain anything you want, including variable value. In other words, the above could for example print something like: filename.cc:123: Test X failed with value 98765. The easiest way to make it work like that is by implementing a macro like: #define DPRINT(...) dprint(__FILE__, __LINE__, __VA_ARGS__) and then implement dprint() as a variadic template function. You could avoid the macro by calling that dprint() function directly and manually writing __FILE__ and __LINE__ every single time, but why? Making it like this makes it easier and handier to use, and allows more easily changing it to do something else instead. I can't think of many drawbacks. |
Daniel <danielaparker@gmail.com>: Feb 03 07:34AM -0800 On Monday, February 3, 2020 at 5:25:12 AM UTC-5, Juha Nieminen wrote: > Not always. One example where a preprocessor macro is useful is when > you want a code line number inserted into a message, eg. when doing > some debugging or printing out error messages in some testing code. Some boost libraries (e.g. Phoenix, Serialization) provide convenience macros for generating repetitive boilerplate code, do you think the "one of the most highly regarded and expertly designed C++ library projects in the world" got it right? or wrong? C++ serialization libraries generally make use of traits which can be a bit formidable to produce by hand, do you think providing macros to generate these is sensible? or stupid? Best regards, Daniel |
You received this digest because you're subscribed to updates for this group. You can change your settings on the group membership page. To unsubscribe from this group and stop receiving emails from it send an email to comp.lang.c+++unsubscribe@googlegroups.com. |
No comments:
Post a Comment