LinuxQuestions.org
Review your favorite Linux distribution.
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices


Reply
  Search this Thread
Old 12-07-2022, 09:28 AM   #16
dugan
LQ Guru
 
Registered: Nov 2003
Location: Canada
Distribution: distro hopper
Posts: 10,773

Rep: Reputation: 5097Reputation: 5097Reputation: 5097Reputation: 5097Reputation: 5097Reputation: 5097Reputation: 5097Reputation: 5097Reputation: 5097Reputation: 5097Reputation: 5097

The point of this assignment is obviously to demonstrate an understanding of these specific concepts. Not to do production-ready engineering. Hence its contrived requirements.

In real life, you would put the queue on a server designed specifically for them, such as ZeroMQ, RabbitMQ, Kafka or Redis.

Last edited by dugan; 12-07-2022 at 11:46 AM.
 
Old 12-07-2022, 08:17 PM   #17
sundialsvcs
LQ Guru
 
Registered: Feb 2004
Location: SE Tennessee, USA
Distribution: Gentoo, LFS
Posts: 10,102
Blog Entries: 4

Rep: Reputation: 3662Reputation: 3662Reputation: 3662Reputation: 3662Reputation: 3662Reputation: 3662Reputation: 3662Reputation: 3662Reputation: 3662Reputation: 3662Reputation: 3662
Yes, it is clear that this is "an exercise," and I would also consider it to be a well-designed one. I hope that the student in question will embrace it.

I would also encourage the student to work directly and closely with the obviously-skilled instructor who created it and assigned it.

Last edited by sundialsvcs; 12-07-2022 at 08:18 PM.
 
Old 12-15-2022, 02:56 PM   #18
sundialsvcs
LQ Guru
 
Registered: Feb 2004
Location: SE Tennessee, USA
Distribution: Gentoo, LFS
Posts: 10,102
Blog Entries: 4

Rep: Reputation: 3662Reputation: 3662Reputation: 3662Reputation: 3662Reputation: 3662Reputation: 3662Reputation: 3662Reputation: 3662Reputation: 3662Reputation: 3662Reputation: 3662
In my experience, the only way to arrange "the reading of a file by multiple processes or threads" is to create a single process or thread which is ultimately responsible for managing the file. Everyone else must issue "requests" to read-or-write specified segments of it, and await the reply. The responsible process now receives these requests one at a time. They are now serialized.

This approach removes all of the uncertainty that is inherent in operating-system level serialization mechanisms, and instead reduces it to a very simple "client/server paradigm." The "server" process or thread now receives all of the requests, one at a time (very fast). It has an extremely simple thing to do, and a clear algorithm for doing it: if there is "contention," this one actor can reliably resolve it. The microseconds required are inconsequential. It is a robust strategy.

Every modern programming language provides the "queue" classes and objects needed to accomplish this – if not a ready-made solution to the entire ("very well-known ...") problem itself. "Do Not Do A Thing Already Done.™"

Last edited by sundialsvcs; 12-15-2022 at 03:05 PM.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
cobbler multi-segmented chrobry Linux - Server 0 08-10-2010 05:23 PM
[SOLVED] Combining two segmented DVDs into one. vikas027 Solaris / OpenSolaris 3 07-08-2010 11:54 PM
Gnome/gdm startup apps: Why are some children of gdm and others children of init? sixerjman Linux - Software 1 07-04-2009 11:48 AM
Session-to-Session Segmented Downloads Raymond C. Glassford Mandriva 2 08-29-2008 10:44 AM
email synchronization (not file synchronization) Moebius Linux - Software 6 10-05-2004 06:31 AM

LinuxQuestions.org > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 11:15 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration