Skip to content
Browse files

Build success

Disk Memory
RAM Memory
  • Loading branch information...
1 parent 6ab4bb1 commit 27d428f2c89f7ba4d082bd6e2b6848fecc303486 @docblades committed Nov 29, 2011
View
4 OpSysTests/OpSysTests.csproj
@@ -6,7 +6,7 @@
<ProductVersion>
</ProductVersion>
<SchemaVersion>2.0</SchemaVersion>
- <ProjectGuid>9b5a93a1-ae6c-4d1d-bfc3-887652f76a2e</ProjectGuid>
+ <ProjectGuid>{3B0816BA-E01C-4351-82BD-0768B140BC6D}</ProjectGuid>
<OutputType>Library</OutputType>
<AppDesignerFolder>Properties</AppDesignerFolder>
<RootNamespace>OpSysTests</RootNamespace>
@@ -33,6 +33,7 @@
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<ItemGroup>
+ <Reference Include="Microsoft.VisualStudio.QualityTools.UnitTestFramework, Version=10.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL" />
<Reference Include="System" />
<Reference Include="System.Core">
<RequiredTargetFramework>3.5</RequiredTargetFramework>
@@ -45,6 +46,7 @@
</ItemGroup>
<ItemGroup>
<Compile Include="Properties\AssemblyInfo.cs" />
+ <Compile Include="UnitTest1.cs" />
</ItemGroup>
<Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
View
32 OperatingSystemSimulation.sln
@@ -3,16 +3,48 @@ Microsoft Visual Studio Solution File, Format Version 11.00
# Visual Studio 2010
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "OperatingSystemSimulation", "OperatingSystemSimulation\OperatingSystemSimulation.csproj", "{B354D4F7-C3EF-46A5-8E69-C50C701E2ED5}"
EndProject
+Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "OpSysTests", "OpSysTests\OpSysTests.csproj", "{3B0816BA-E01C-4351-82BD-0768B140BC6D}"
+EndProject
+Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution Items", "{D41741F3-6AE1-42BC-94BD-79CEBD16A0B2}"
+ ProjectSection(SolutionItems) = preProject
+ Local.testsettings = Local.testsettings
+ OperatingSystemSimulation.vsmdi = OperatingSystemSimulation.vsmdi
+ TraceAndTestImpact.testsettings = TraceAndTestImpact.testsettings
+ EndProjectSection
+EndProject
Global
+ GlobalSection(TestCaseManagementSettings) = postSolution
+ CategoryFile = OperatingSystemSimulation.vsmdi
+ EndGlobalSection
GlobalSection(SolutionConfigurationPlatforms) = preSolution
+ Debug|Any CPU = Debug|Any CPU
+ Debug|Mixed Platforms = Debug|Mixed Platforms
Debug|x86 = Debug|x86
+ Release|Any CPU = Release|Any CPU
+ Release|Mixed Platforms = Release|Mixed Platforms
Release|x86 = Release|x86
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
+ {B354D4F7-C3EF-46A5-8E69-C50C701E2ED5}.Debug|Any CPU.ActiveCfg = Debug|x86
+ {B354D4F7-C3EF-46A5-8E69-C50C701E2ED5}.Debug|Mixed Platforms.ActiveCfg = Debug|x86
+ {B354D4F7-C3EF-46A5-8E69-C50C701E2ED5}.Debug|Mixed Platforms.Build.0 = Debug|x86
{B354D4F7-C3EF-46A5-8E69-C50C701E2ED5}.Debug|x86.ActiveCfg = Debug|x86
{B354D4F7-C3EF-46A5-8E69-C50C701E2ED5}.Debug|x86.Build.0 = Debug|x86
+ {B354D4F7-C3EF-46A5-8E69-C50C701E2ED5}.Release|Any CPU.ActiveCfg = Release|x86
+ {B354D4F7-C3EF-46A5-8E69-C50C701E2ED5}.Release|Mixed Platforms.ActiveCfg = Release|x86
+ {B354D4F7-C3EF-46A5-8E69-C50C701E2ED5}.Release|Mixed Platforms.Build.0 = Release|x86
{B354D4F7-C3EF-46A5-8E69-C50C701E2ED5}.Release|x86.ActiveCfg = Release|x86
{B354D4F7-C3EF-46A5-8E69-C50C701E2ED5}.Release|x86.Build.0 = Release|x86
+ {3B0816BA-E01C-4351-82BD-0768B140BC6D}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+ {3B0816BA-E01C-4351-82BD-0768B140BC6D}.Debug|Any CPU.Build.0 = Debug|Any CPU
+ {3B0816BA-E01C-4351-82BD-0768B140BC6D}.Debug|Mixed Platforms.ActiveCfg = Debug|Any CPU
+ {3B0816BA-E01C-4351-82BD-0768B140BC6D}.Debug|Mixed Platforms.Build.0 = Debug|Any CPU
+ {3B0816BA-E01C-4351-82BD-0768B140BC6D}.Debug|x86.ActiveCfg = Debug|Any CPU
+ {3B0816BA-E01C-4351-82BD-0768B140BC6D}.Release|Any CPU.ActiveCfg = Release|Any CPU
+ {3B0816BA-E01C-4351-82BD-0768B140BC6D}.Release|Any CPU.Build.0 = Release|Any CPU
+ {3B0816BA-E01C-4351-82BD-0768B140BC6D}.Release|Mixed Platforms.ActiveCfg = Release|Any CPU
+ {3B0816BA-E01C-4351-82BD-0768B140BC6D}.Release|Mixed Platforms.Build.0 = Release|Any CPU
+ {3B0816BA-E01C-4351-82BD-0768B140BC6D}.Release|x86.ActiveCfg = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
View
2 OperatingSystemSimulation/OperatingSystemSimulation.csproj
@@ -50,11 +50,13 @@
<Compile Include="src\CPU\RoundRobinCPU.cs" />
<Compile Include="src\Instructions\Instruction.cs" />
<Compile Include="src\Instructions\InstructionFactory.cs" />
+ <Compile Include="src\Memory\Disk.cs" />
<Compile Include="src\Memory\DMAThread.cs" />
<Compile Include="src\Memory\IMemory.cs" />
<Compile Include="src\Memory\Page.cs" />
<Compile Include="src\Memory\PageTable.cs" />
<Compile Include="src\Memory\ProgramCache.cs" />
+ <Compile Include="src\Memory\RAM.cs" />
<Compile Include="src\Process\IProcess.cs" />
<Compile Include="src\Process\Process.cs" />
<Compile Include="src\Process\ProcessControlBlock.cs" />
View
10 OperatingSystemSimulation/src/CPU/ICPU.cs
@@ -8,10 +8,10 @@ namespace OperatingSystemSimulation.src.CPU
{
public interface ICPU
{
- public int CPUID { get; }
- public int ProcessCount { get; }
- public void AddProcess(IProcess process);
- public void StartCPU { get; }
- public void Shutdown();
+ int CPUID { get; }
+ int ProcessCount { get; }
+ void AddProcess(IProcess process);
+ void StartCPU();
+ void Shutdown();
}
}
View
4 OperatingSystemSimulation/src/CPU/RoundRobinCPU.cs
@@ -29,9 +29,9 @@ public void AddProcess(IProcess process)
ProcessQueue.EnQueue(process);
}
- public void StartCPU
+ public void StartCPU()
{
- get { throw new NotImplementedException(); }
+ throw new NotImplementedException();
}
private void WorkingLoop()
View
33 OperatingSystemSimulation/src/Memory/Disk.cs
@@ -0,0 +1,33 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.IO;
+
+namespace OperatingSystemSimulation.src.Memory
+{
+ class Disk : IMemory
+ {
+ Stream FileStream { get; set; }
+
+ public Disk(string fileName)
+ {
+ FileStream = File.Open(fileName, FileMode.OpenOrCreate, FileAccess.ReadWrite, FileShare.Read);
+ }
+
+ public void write(int address, int value)
+ {
+ BinaryWriter writer = new BinaryWriter(FileStream);
+ writer.Seek(address, SeekOrigin.Begin);
+ writer.Write(value);
+ }
+
+ public int read(int address)
+ {
+ BinaryReader reader = new BinaryReader(FileStream);
+ reader.BaseStream.Seek(address, SeekOrigin.Begin);
+
+ return reader.ReadInt32();
+ }
+ }
+}
View
4 OperatingSystemSimulation/src/Memory/IMemory.cs
@@ -7,7 +7,7 @@ namespace OperatingSystemSimulation.src.Memory
{
public interface IMemory
{
- public void write(Int32 address, Int32 value);
- public Int32 read(Int32 address);
+ void write(Int32 address, Int32 value);
+ Int32 read(Int32 address);
}
}
View
27 OperatingSystemSimulation/src/Memory/RAM.cs
@@ -0,0 +1,27 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+
+namespace OperatingSystemSimulation.src.Memory
+{
+ class RAM : IMemory
+ {
+ private IList<Int32> LocalMem { get; set; }
+
+ public RAM(int size)
+ {
+ LocalMem = new List<Int32>(size);
+ }
+
+ public void write(int address, int value)
+ {
+ LocalMem[address] = value;
+ }
+
+ public int read(int address)
+ {
+ return LocalMem[address];
+ }
+ }
+}
View
2 OperatingSystemSimulation/src/Process/IProcess.cs
@@ -5,7 +5,7 @@
namespace OperatingSystemSimulation.src.Process
{
- interface IProcess
+ public interface IProcess
{
}

0 comments on commit 27d428f

Please sign in to comment.
Something went wrong with that request. Please try again.