- cmsg cancel <o1t4du$724$4@dont-email.me> - 2 Updates
- Read again... - 1 Update
- I correct my logic, please read again my final post... - 1 Update
- About functional programming and object oriented programming.. - 1 Update
bleachbot <bleachbot@httrack.com>: Dec 03 01:43AM +0100 |
bleachbot <bleachbot@httrack.com>: Dec 03 02:19AM +0100 |
Ramine <ramine@1.1>: Dec 02 08:19PM -0500 Hello.... Functional programming is stupid What it wants to sell that it uses pure functions so that it avoids race conditions, but since Haskel uses Mvars, it is like blocking queues , it is prone to Deadlocks and to starvation, so Functional programming doesn't compose well in the parallel programming world. So what i advice is to use Object oriented programming with transactional memory or a scalable reader-writer lock that wraps the reads and writes, because transactional memory is easy and because scalable reader-writer lock is easy , so i think it ensure a level of security that is acceptable. In the criterion of expressivity and productivity , i don't think that Functional programming buys much, so i think that Object oriented progrmming will still be used and a prefered tool in the future. Thank you, Amine Moulay Ramdane. |
Ramine <ramine@1.1>: Dec 02 07:44PM -0500 I correct my logic, please read again my final post... Hello............. Here is my final solution that i think works efficiently... First it is better to do this: I think that C++ and ADA and Object Pascal must make the data types objects, and make datastructures objects and make IO objects etc. and wrap those objects with a scalable reader-writer lock or transactional memory because it is easy to do it this way, and the compiler designers and implementors must test those objects correctly to ensure that they work correctly, this will ensure a level of security that avoids race conditions that is tolerable, so no need for pure functions and Mvars of Haskel and Lisp. And second you have to use set() and get() wrapped with a scalable reader-writer lock or transactional memory to access the properties of the object because it is easy to do it this way. and third you can add also this: About C++ and my following enhancement to it... C++ must add properties that you can access only from the constructor and can not be accessed from the methods of the object. This way you will be able to implement more cleanly my following implementation: First you have to call a constructor that will put the global variables as pointer that are shared by threads in there respective queues.. And after that each method that wants to access a shared global variable will take the shared global variable from the queue and copy it in a local variable and work with it locally, and after that it will put it back in its global queue , and other threads will block waiting for the variables on there respective queues, it's like message passing and it's like pure functions with Mvars in Haskel and this mechanism is good and will avoid race conditions in Object oriented programming. If you say to me that pure functions of Lisp and Haskel are pure functions , but with my previous implementation you still can by error forget to put your global variables that is shared by threads in the properties that can not be accessed by the object or in there respective global queues, i will say that my implementation easy the job for us, because defining what is shared and putting it in the properties that can not be accessed from the object is easy and is as easy as making an error on sequential programming, so in my opinion this level of security can be tolerated in Object oriented programming without using Functional programming, other than that we also have Transactional memory that is composable and easy to use to solve our parallel programming problems in Object oriented programming. For Deadlocks use this: Use Lock Hierarchies to Avoid Deadlock http://www.drdobbs.com/parallel/use-lock-hierarchies-to-avoid-deadlock/204801163 Thank you, Amine Moulay Ramdane. |
Ramine <ramine@1.1>: Dec 02 02:47PM -0500 Hello.... About functional programming and object oriented programming.. I have continued to read about Lisp and Haskel functional languages, and i have finally understood functional programming, in Lisp and Haskel the functions are pure , that means that they don't call global variables, but when you want to do mutability, you have ,like in message passing, to pass the local variable to an Mvar in Haskel, it's like a queue, where the other threads must grap this local variable and copy it in a local variable and change it and put back this local variable in the queue for the other threads to change it, so you will avoid race conditions in parallel programming with this mechanism, but Mvar or the queues are still prone to Deadlock or starvation. I have learned Lisp and Haskel and i have noticed that to avoid the readability problem that i have spook about in my previous post you have to decompose the many brackets with the defun. In object oriented programming you can implement the Mvar of Haskel with queues and you can avoid the problem of race conditions. Thank you, Amine Moulay Ramdane. |
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.programming.threads+unsubscribe@googlegroups.com. |
No comments:
Post a Comment