473,505 Members | 16,332 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

migration single processor to dual processor problem with threadin

Hello,

I have an application, that has been running on a single processor server
for more then a year without any problems. Now I'm migrating to a dual
processor server, and I'm experiencing problems with threading.

The application is actually a kind of job schedular. For all jobs, I can set
a recurring interval (daily,weekly, monthly etc) at which the specific job
should be started. We program each job, according to an interface. Examples
of jobs are: server monitoring, reporting, messaging etc.

The job itself maintains a status. When it's complete, it's status is set to
ready.

The job-schedular looks at certain times for two things: Should I start a
new job and Is there a job with status Ready which should be stopped.

the code for stopping a job is only a:
ji.InstanceThread.Abort();
ji.InstanceThread.Join(1000);
MJSJobList._jobList.Remove(ji);
What I now see, is that on the single processor server, this works, and the
job is removed from the list.
On the dual-processor server, however the job remains in the list with
status "Ready"..

Am I missing somethinge here ? The code worked perfectly on the other server
for a very long time.

Thanks in advance,
Michel Meex
Jun 2 '06 #1
3 1423
Michel,

Can you provide a more complete snipet of code? It's too difficult to
say what might be happening based only on 3 lines.

Brian

Michel Meex wrote:
Hello,

I have an application, that has been running on a single processor server
for more then a year without any problems. Now I'm migrating to a dual
processor server, and I'm experiencing problems with threading.

The application is actually a kind of job schedular. For all jobs, I can set
a recurring interval (daily,weekly, monthly etc) at which the specific job
should be started. We program each job, according to an interface. Examples
of jobs are: server monitoring, reporting, messaging etc.

The job itself maintains a status. When it's complete, it's status is set to
ready.

The job-schedular looks at certain times for two things: Should I start a
new job and Is there a job with status Ready which should be stopped.

the code for stopping a job is only a:
ji.InstanceThread.Abort();
ji.InstanceThread.Join(1000);
MJSJobList._jobList.Remove(ji);
What I now see, is that on the single processor server, this works, and the
job is removed from the list.
On the dual-processor server, however the job remains in the list with
status "Ready"..

Am I missing somethinge here ? The code worked perfectly on the other server
for a very long time.

Thanks in advance,
Michel Meex


Jun 2 '06 #2
Agreed. Not much to go on.

As a wild stab in the dark I would point out that any resource that is
accessed from more than one thread should really be marked as volatile. This
effectively says, don't get this from processor cached memory, do a read
from system memory. It is especially important to consider this in mult-proc
enviroments as your threads may end up executing on different chips.

In this case apply volatile to _jobList in MJSJobList.
"Brian Gideon" <br*********@yahoo.com> wrote in message
news:11**********************@f6g2000cwb.googlegro ups.com...
Michel,

Can you provide a more complete snipet of code? It's too difficult to
say what might be happening based only on 3 lines.

Brian

Michel Meex wrote:
Hello,

I have an application, that has been running on a single processor server
for more then a year without any problems. Now I'm migrating to a dual
processor server, and I'm experiencing problems with threading.

The application is actually a kind of job schedular. For all jobs, I can
set
a recurring interval (daily,weekly, monthly etc) at which the specific
job
should be started. We program each job, according to an interface.
Examples
of jobs are: server monitoring, reporting, messaging etc.

The job itself maintains a status. When it's complete, it's status is set
to
ready.

The job-schedular looks at certain times for two things: Should I start a
new job and Is there a job with status Ready which should be stopped.

the code for stopping a job is only a:
ji.InstanceThread.Abort();
ji.InstanceThread.Join(1000);
MJSJobList._jobList.Remove(ji);
What I now see, is that on the single processor server, this works, and
the
job is removed from the list.
On the dual-processor server, however the job remains in the list with
status "Ready"..

Am I missing somethinge here ? The code worked perfectly on the other
server
for a very long time.

Thanks in advance,
Michel Meex

Jun 3 '06 #3
Ok, here's some more code.

In the windows service, a timer executes the following method:
internal void MonitorJobs()
{
ArrayList al = this.RetrieveJobsState();
foreach(MJSJobState js in al)
{
//If job is ready
if (js.JobState == MJSJobStatic.JobState.Ready)
{
TempLogging(js.JobName,"Job found, status ready, should stop");
bool _found = false;
//stop and clear job
foreach (MJSJobInstance ji in MJSJobList._jobList)
{
if (ji.JobData.JobName == js.JobName)
{
_found = true;
this.JobStop(ji.JobData);
break; }
}
TempLogging(js.JobName,"Job found: " + _found.ToString());
}
}
}

the method JobStop contains the following:
public void JobStop(MJSJobData jobData)
{
if (jobData != null)
{
//if job is running
if (this.JobIsRunning(jobData) ==
MJSJobStatic.ThreeValueBool.True)
{
bool jobStopped = false;
//Find job instance in joblist
foreach (MJSJobInstance ji in MJSJobList._jobList)
{
if (jobData != null)
{
if (jobData.JobName == ji.JobData.JobName)
{
//Call job stop method (IJob interface),
((IJob) ji.InstanceObject).Stop();
//Clear object reference
ji.InstanceObject = null;
//Stop process / end thread
ji.InstanceThread.Abort();
ji.InstanceThread.Join(1000);

//debugging info
HistoryData _tempHistoryNew = new HistoryData();
_tempHistoryNew.JobName = ji.JobData.JobName;
_tempHistoryNew.Type = MJSJobStatic.HistoryType.Information;
_tempHistoryNew.Time = System.DateTime.Now;
_tempHistoryNew.Extra = "trying to stop.....debug info";
JobHistory.Add(_tempHistoryNew);
//end debugging info

//Remove job from JobList
MJSJobList._jobList.Remove(ji);
jobStopped = true;
break;
}
}
}

if (jobStopped)
{
//Log event
HistoryData _tempHistoryNew = new HistoryData();
_tempHistoryNew.JobName = jobData.JobName;
_tempHistoryNew.Type = MJSJobStatic.HistoryType.Information;
_tempHistoryNew.Time = System.DateTime.Now;
_tempHistoryNew.Extra = JOB_STOPPED;
JobHistory.Add(_tempHistoryNew);
}
else
{
//Log event
HistoryData _tempHistoryNew = new HistoryData();
_tempHistoryNew.JobName = jobData.JobName;
_tempHistoryNew.Type = MJSJobStatic.HistoryType.Error;
_tempHistoryNew.Time = System.DateTime.Now;
_tempHistoryNew.Extra = "Job could not be stopped.";
JobHistory.Add(_tempHistoryNew);
}
}
else
{
//Write something to the log
//Log event
HistoryData _tempHistoryNew = new HistoryData();
_tempHistoryNew.JobName = jobData.JobName;
_tempHistoryNew.Type = MJSJobStatic.HistoryType.Error;
_tempHistoryNew.Time = System.DateTime.Now;
_tempHistoryNew.Extra = "Job could not be stopped. The job is not
running.";
JobHistory.Add(_tempHistoryNew);
}
}
else
{
//Write something to the log if running state of job could not be
determined
//Log event
HistoryData _tempHistoryNew = new HistoryData();
_tempHistoryNew.JobName = string.Empty;
_tempHistoryNew.Type = MJSJobStatic.HistoryType.Error;
_tempHistoryNew.Time = System.DateTime.Now;
_tempHistoryNew.Extra = "Job could not be stopped. No job provided.";
JobHistory.Add(_tempHistoryNew);
}
}

I hope you can do something with this..
Regards,
Michel
Jun 6 '06 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

9
5823
by: Tomer Ben-David | last post by:
Hi I have a big j2ee appliction that was so forth run on a single cpu machine. I have tested it on a dual cpu machine, its running much slower (about X3 times slower). I know that...
1
3150
by: Frank | last post by:
Hi, we are using oracle clients (Release 9.0.1.0.1 - Production) on an NT4 (Service Pack6) computers. the server is a W2K, (Oracle9i Enterprise Edition Release 9.0.1.1.1 - Production With the...
1
1877
by: seesharp | last post by:
Hi, we have a multithreaded application (win service) written in C# that is running well on all but one box. The only difference we see between the problem box and the good ones is that the...
3
3100
by: Amit Dedhia | last post by:
Hi I am developing a Dot net application (involving image processing) on a uni processor. It works well on my machine. I then take all my code on a multi processor, build and run the application...
7
4215
by: cwahlmeier | last post by:
Greetings, I am running DB2 Workgroup Edition on an Intel box with two physical CPUs. It is running Windows with hyperthreading. Thus, the operating system thinks it has 4 cpus. I am about to...
8
1917
by: Darryl Kerkeslager | last post by:
Not that I'm going to go out and buy a new motherboard, but, will a dual processor PC run a huge report query and still allow a user to use other programs while the query is running? --...
1
1390
by: Michel Meex | last post by:
Hello, I have an application, that has been running on a single processor server for more then a year without any problems. Now I'm migrating to a dual processor server, and I'm experiencing...
1
1387
by: xtseeker | last post by:
We have a multi-threaded .NET application, the problem is that the previous programmer didn't care to have locks on the shared variables. Somehow the application doesn't end up in Locked state on a...
1
2324
by: teddysnips | last post by:
I am preparing a proposal for a new client. The client has bought a dual-processor server, but is keen to save money. They run a very small business, and I believe that the 4 Gb limit on SQL...
0
7218
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
7307
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
7370
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
7478
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
5614
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
1
5035
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
3177
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
755
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
409
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.