{"id":21670511,"url":"https://github.com/engineering87/mldatacontentionprediction","last_synced_at":"2025-07-04T15:34:23.881Z","repository":{"id":156746170,"uuid":"628964816","full_name":"engineering87/MLDataContentionPrediction","owner":"engineering87","description":"Machine Learning educational project for analysis and prediction of data contention with ML.NET ","archived":false,"fork":false,"pushed_at":"2023-04-26T21:20:49.000Z","size":18789,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-07-04T15:34:15.923Z","etag":null,"topics":["dotnet","machine-learning"],"latest_commit_sha":null,"homepage":"","language":"C#","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/engineering87.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2023-04-17T10:48:57.000Z","updated_at":"2023-04-21T16:52:28.000Z","dependencies_parsed_at":null,"dependency_job_id":"03f15787-40e8-4ad3-9859-73c6d53b3bcf","html_url":"https://github.com/engineering87/MLDataContentionPrediction","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/engineering87/MLDataContentionPrediction","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/engineering87%2FMLDataContentionPrediction","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/engineering87%2FMLDataContentionPrediction/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/engineering87%2FMLDataContentionPrediction/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/engineering87%2FMLDataContentionPrediction/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/engineering87","download_url":"https://codeload.github.com/engineering87/MLDataContentionPrediction/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/engineering87%2FMLDataContentionPrediction/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":263567995,"owners_count":23481597,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["dotnet","machine-learning"],"created_at":"2024-11-25T12:32:44.419Z","updated_at":"2025-07-04T15:34:23.842Z","avatar_url":"https://github.com/engineering87.png","language":"C#","readme":"# A Machine Learning model to predict Data Contention\n\nThis is a project developed in .NET 6 and ML.NET library for the analysis and prediction of data contention in lock based system by varying different parameters, such as the number of concurrent tasks, the critical section size and lock execution time. The final purpose is to predict the waiting time of a task to access the critical section.\n\n### How it works\nThe project consists of three distinct modules: a data contention simulation module, which can be parameterized to simulate different application contexts; a module for generating the predictive model using ML.NET library; a module for managing and orchestrating simulations and machine learning models.\n\n### Architecture\n\u003cimg width=\"600\" src=\"https://github.com/engineering87/MLDataContentionPrediction/blob/main/static/architecture.png\" style=\"vertical-align:middle\"\u003e\n\n### The Case Study\nThe case study is a didactic simulation of the data contention in a concurrent environment. The critical section is represented as a circular list of objects, a set of tasks tries to access the critical section by scanning the list in search of a non-locked slot.\n\n### Model hypothesis\nFor the experiment we consider the following assumptions:\n\n* The execution within the single slot of the critical section is of fixed duration and equal for each task\n* The number of tasks is no greater than the number of slots available within the critical section\n* The critical section scan time is 0\n\nSo we have:\n\n* $𝑤_(k, c, s)$ represents the waiting time\n* $𝐷_(k,c, s)$ represents dispatching time\n* $𝑆$ represents the time the slot is occupied\n* $𝑤_(𝑘,c,s)=𝐷_(𝑘,c,s)−𝑆$\n* $C≥𝐾$\n\n### How to configure it\nThe simulation and machine learning model configurations are fully described in the JSON *appsettings.json* file within the orchestrator's project.\n\n```json\n{\n  \"Configuration\": {\n    \"ResultFilePath\": \"\\\\Data\\\\Result.csv\",\n    \"TrainingFilePath\": \"\\\\Data\\\\Training.csv\",\n    \"TestFilePath\": \"\\\\Data\\\\Test.csv\",\n    \"SimulationFilePath\": \"\\\\Data\\\\Simulation.zip\",\n    \"MinThread\": \"2\",\n    \"MaxThread\": \"10\",\n    \"MinTimeOnSection\": \"100\",\n    \"MaxTimeOnSection\": \"500\",\n    \"MinCriticalSectionDimension\": \"2\",\n    \"MaxCriticalSectionDimension\": \"14\",\n    \"PredictionSimulationTime\": \"20\",\n    \"TotalSimulationDimension\": \"100\",\n    \"PartialSimulationDimension\": \"10\",\n    \"TrainingSetPercentage\": \"70\",\n    \"TotalSamples\":  \"2\"\n  }\n}\n```\n\nIn the configuration file you can change any parameter of the simulation as you like, such as the task number, the interval of critical section size and the interval of lock execution time. It is also possible to modify the number of total samples to collect, the training time of the machine learning model and the size, in percentage, of the training set.\n\n### Usage\nTo start the project, simply launch the **CriticalSectionOrchestrator** project on VS after having appropriately configured the parameters for the simulation in the JSON file.\n\n### Result\nAt the end of the simulation and prediction, the distribution graph will be show to assess the reliability of the model obtained. The ML model will be compared with the simulation results in terms of waiting time.\n\n\n\n### ML.NET\nML.NET is an open source and cross-platform machine learning framework, below the references of the project:\n * [MainSite] (https://dotnet.microsoft.com/apps/machinelearning-ai/ml-dotnet)\n * [GitHub] (https://github.com/dotnet/machinelearning)\n\n### Contributing\nThank you for considering to help out with the source code! We welcome contributions from anyone on the internet, and are grateful for even the smallest of fixes!\nIf you'd like to contribute, please fork, fix, commit and send a pull request for the maintainers to review and merge into the main code base.\n\n**Getting started with Git and GitHub**\n\n * [Setting up Git for Windows and connecting to GitHub](http://help.github.com/win-set-up-git/)\n * [Forking a GitHub repository](http://help.github.com/fork-a-repo/)\n * [The simple guide to GIT guide](http://rogerdudler.github.com/git-guide/)\n * [Open an issue](https://github.com/engineering87/MLDataContentionPrediction/issues) if you encounter a bug or have a suggestion for improvements/features\n\n### Licensee\nMLDataContentionPrediction source code is available under MIT License, see license in the source.\n\n### Contact\nPlease contact at francesco.delre.87[at]gmail.com for any details.\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fengineering87%2Fmldatacontentionprediction","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fengineering87%2Fmldatacontentionprediction","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fengineering87%2Fmldatacontentionprediction/lists"}