Cook pasta in salted boiling water till al dente. Set aside.
In the same pot, add the olive oil and onion. Cook over medium heat, stirring often, till onion is translucent, about 5 minutes. Add garlic and cook one more minute.
Stir in the flour till all the onions are coated and flour is absorbed. You can add a little more olive oil if you need to.
Whisk in the milk and continue cooking and stirring till mixture comes to a boil. Boil and stir for at least one minute.
Add pepper, ham, peas, Parmesan cheese, and cooked pasta. Heat through. Add salt and pepper to taste.