小编Vin*_*ent的帖子

为什么我的多线程比单线程慢?

我知道有几个人问了一个与此相似的问题,但我找不到任何能让我理解为什么它变慢的回答.

因此,我为自己对Visual Studio 2013中的线程对象的理解制作了一个小程序控制台程序.我的CPU是Intel Core i7,供应可以使用多个线程.

我的代码:

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Threading;
using System.Diagnostics;

namespace ConsoleApplication1
{
    class Program
    {

        static TimeSpan MTTime;
        static TimeSpan STTime;

        static void Main(string[] args)
        {
            Stopwatch stopwatch = new Stopwatch();
            stopwatch.Start();


            Console.WriteLine(Environment.NewLine + "---------------Multi Process-------------" + Environment.NewLine);

            Thread th1 = new Thread(new ParameterizedThreadStart(Process));
            Thread th2 = new Thread(new ParameterizedThreadStart(Process));
            Thread th3 = new Thread(new ParameterizedThreadStart(Process));
            Thread th4 = new Thread(new ParameterizedThreadStart(Process));

            th1.Start("A");
            th2.Start("B");
            th3.Start("C");
            th4.Start("D");

            th1.Join();
            th2.Join(); …
Run Code Online (Sandbox Code Playgroud)

c# multithreading

32
推荐指数
2
解决办法
1万
查看次数

OCL限制检查Eclipse Papyrus

有没有人设法检查Eclipse Papyrus中建模的类图上的OCL约束?我已经定义了一个简单的测试配置文件,只对一个构造型属性有一个约束:

{OCL} self.property > 0
Run Code Online (Sandbox Code Playgroud)

构造型扩展了Property元类,因此我将它应用于类属性,并将构造型的属性设置为0.但是我从未在上下文菜单中使用Validation> Validate Model命令出错.

任何帮助都会非常感激.

谢谢你提前.

uml eclipse-plugin check-constraints ocl papyrus

3
推荐指数
1
解决办法
992
查看次数