Click here to Skip to main content

Pablo Aliskevicius - Professional Profile

@PabloAliskevicius

Summary

14,083
Author
4,731
Authority
896
Debator
62
Editor
39
Enquirer
683
Organiser
1,861
Participant
Pablo writes code for a living, in C++, C#, and SQL.
 
To make all that work easier, he uses some C++ libraries: STL, ATL & WTL (to write Windows applications), and code generation.
 
Pablo was born in 1963, got married in 1998, and is the proud father of two wonderful girls.
 
Favorite quotes:
"Accident: An inevitable occurrence due to the action of immutable natural laws." (Ambrose Bierce, "The Devil's Dictionary", published in several newspapers between 1881 and 1906).
"You are to act in the light of experience as guided by intelligence" (Rex Stout, "In the Best Families", 1950).
Member since Tuesday, March 25, 2003 (11 years, 5 months)
  • 18 Oct 2013: Best C++ article of September 2013

 

Contributions

Articles 7 (Legend)
Tech Blogs 0
Messages 246 (Regular)
Q&A Questions 0
Q&A Answers 165
Tips/Tricks 2
Comments 131

Links

Reputation

For more information on Reputation please see the FAQ.

Privileges

Members need to achieve at least one of the given member levels in the given reputation categories in order to perform a given action. For example, to store personal files in your account area you will need to achieve Platinum level in either the Author or Authority category. The "If Owner" column means that owners of an item automatically have the privilege, and the given member types also gain the privilege regardless of their reputation level.

ActionAuthorAuthorityDebatorEditorEnquirerOrganiserParticipantIf OwnerMember Types
Have no restrictions on voting frequencysilversilversilversilverAdmin
Store personal files in your account areaplatinumplatinumSitebuilder, Subeditor, Supporter, Editor, Staff
Have live hyperlinks in your biographybronzebronzebronzebronzebronzebronzesilverSubeditor, Protector, Editor, Staff, Admin
Edit a Question in Q&AsilversilversilversilverYesSubeditor, Protector, Editor, Admin
Edit an Answer in Q&AsilversilversilversilverYesSubeditor, Protector, Editor, Admin
Delete a Question in Q&AYesSubeditor, Protector, Editor, Admin
Delete an Answer in Q&AYesSubeditor, Protector, Editor, Admin
Report an ArticlesilversilversilversilverSubeditor, Mentor, Protector, Editor, Staff, Admin
Approve/Disapprove a pending ArticlegoldgoldgoldgoldSubeditor, Mentor, Protector, Editor, Staff, Admin
Edit other members' articlesSubeditor, Protector, Editor, Admin
Create an article without requiring moderationplatinumSubeditor, Mentor, Protector, Editor, Staff, Admin
Report a forum messagesilversilverbronzeProtector, Editor, Admin
Create a new tagsilversilversilversilverAdmin
Modify a tagsilversilversilversilverAdmin

Actions with a green tick can be performed by this member.


 
GeneralOn global pointers. [modified] PinmemberPablo Aliskevicius4-Apr-12 19:42 
GeneralThe programmer as an artist PinmemberPablo Aliskevicius12-Sep-11 23:09 
GeneralRe: The programmer as an artist PinmemberAniruddha Loya14-Nov-11 21:29 
GeneralThere is no such thing as quick and dirty. PinmemberPablo Aliskevicius30-Mar-09 21:30 
GeneralRe: There is no such thing as quick and dirty. Pinmember ThatsAlok 18-Jul-11 22:57 
GeneralRe: There is no such thing as quick and dirty. PinmemberPablo Aliskevicius19-Jul-11 2:39 
GeneralRe: There is no such thing as quick and dirty. Pinmember ThatsAlok 20-Jul-11 1:07 
GeneralShame on me: a race condition.... PinmemberPablo Aliskevicius28-May-08 8:39 
GeneralWhen multithreading is not an option... PinmemberPablo Aliskevicius19-Mar-07 10:18 

The word 'legacy' means different things to different people. To me, it brings associations of hounted manors...

A few weeks ago, I found myself writing a program (Windows service, listens for events and passes them on) which had to use a legacy DLL while providing decent performance.
The first thing that came to mind was multithreading. It didn't last.

That DLL does not support multithreading: it has lots of global variables, which, if you're old enough, you may remember were deemed 'efficient' by C programmers, since they don't take stack space; in the days of DOS, with 32Kb stack, that was meaningful.
Refactoring the DLL was not an option: lots of work and lots of testing, with the prospect of breaking something, and under an extremely tight budget; and someone else is in charge of maintenance of that DLL.

Then I remembered having seen somewhere threads referred to as 'lightweight processes' (in a book about Windows 95 programming), so I figured, can processes do the task?


Fortunately, the DLL exposes only one function, which performs a rather lengthy batch operation.

The solution was like this:

I wrote an EXE which takes parameters somehow (it reads them from a SQL stored procedure, but the command line or a text file could have been used as well), and passes them to the DLL.
The service manages a process pool, whose maximum size depends on the number of CPUS in the machine.
When an event is detected, it's added to the SQL table which the aforementioned procedure reads from; one of the server processes is selected from the pool; if it's necessary, CreateProcess() is called on the executable (unless it's already running).

It might seem a bit crude, but it gives above-decent performance, the service itself keeps a tiny footprint (it has no code that really 'does' stuff), and any crashes in the legacy DLL (it didn't happen yet, but it might) don't crash the service.

Also, debugging a 'regular process' (single threaded) is easier than debugging a multi-threaded service.

The moral? Sometimes heavyweight is the right weight. As much as I like threads, there are other tools available, and they should not be forgotten.

 

Pablo_A

GeneralMore on thread procedures... PinmemberPablo Aliskevicius13-Oct-06 3:36 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.


Advertise | Privacy | Mobile
Web01 | 2.8.140827.1 | Last Updated 31 Aug 2014
Copyright © CodeProject, 1999-2014
All Rights Reserved. Terms of Service
Layout: fixed | fluid